/* CRM compatibility layer on top of Jidox/Bootstrap */

body {
    font-family: "Roboto", "Noto Sans Arabic", Tahoma, sans-serif;
}

html[lang="ar"] body {
    font-family: "Noto Sans Arabic", "Roboto", Tahoma, sans-serif;
}

.muted {
    color: var(--ct-secondary-color, #6c757d) !important;
}

.small {
    font-size: 0.8125rem;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.page-head h1 {
    font-size: 1.35rem;
    margin: 0 0 0.2rem;
    font-weight: 600;
}

.page-head p {
    margin: 0;
}

.content-page > .content {
    padding-top: 1.25rem;
}

.content-page .card {
    padding: 1.25rem;
}

.content-page .card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.content-page .card .card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.content-page .card .card-head h2 {
    margin: 0;
}

.content-page .card .table {
    margin-bottom: 0;
}

.grid-kpi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 1rem;
}

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

.grid-2 > .card,
.grid-kpi > .card,
.detail-grid > .card {
    margin-bottom: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.kpi {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.kpi-label {
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.95rem;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
}

.field > span {
    font-size: 0.8125rem;
    color: var(--ct-secondary-color, #6c757d);
}

.field input,
.field select,
.field textarea,
.filter-bar input,
.filter-bar select {
    display: block;
    width: 100%;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--ct-body-color, #6c757d);
    background-color: var(--ct-secondary-bg, #fff);
    border: 1px solid var(--ct-border-color, #dee2e6);
    border-radius: var(--ct-border-radius, 0.15rem);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-bar input:focus,
.filter-bar select:focus {
    outline: 0;
    border-color: var(--ct-primary, #4254ba);
    box-shadow: 0 0 0 0.15rem rgba(66, 84, 186, 0.15);
}

.field textarea {
    min-height: 110px;
    resize: vertical;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-bar input,
.filter-bar select {
    width: auto;
    min-width: 160px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
}

.checkbox input {
    width: auto;
}

.btn-ghost {
    color: var(--ct-secondary-color, #6c757d);
    background-color: transparent;
    border: 1px solid var(--ct-border-color, #dee2e6);
}

.btn-ghost:hover,
.btn-ghost:focus {
    color: var(--ct-body-color, #6c757d);
    background-color: var(--ct-tertiary-bg, #f2f2f7);
    border-color: var(--ct-border-color, #dee2e6);
}

.btn-block {
    width: 100%;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

.table > :not(caption) > * > * {
    vertical-align: middle;
}

/* Alerts */
.alert-error {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

html[data-bs-theme="dark"] .alert-error {
    color: #ea868f;
    background-color: rgba(247, 71, 58, 0.15);
    border-color: rgba(247, 71, 58, 0.35);
}

/* Badges */
.badge-new,
.badge-demo {
    color: #299bf6;
    background-color: rgba(41, 155, 246, 0.14);
}

.badge-contacted,
.badge-presentation,
.badge-medium {
    color: #b07d00;
    background-color: rgba(254, 194, 13, 0.18);
}

.badge-qualified,
.badge-negotiation,
.badge-in_progress {
    color: #4254ba;
    background-color: rgba(66, 84, 186, 0.14);
}

.badge-converted,
.badge-won,
.badge-done,
.badge-attended {
    color: #17a497;
    background-color: rgba(23, 164, 151, 0.15);
}

.badge-lost,
.badge-unqualified,
.badge-cancelled,
.badge-high {
    color: #f7473a;
    background-color: rgba(247, 71, 58, 0.13);
}

.badge-price_quote,
.badge-todo,
.badge-backlog {
    color: #6c757d;
    background-color: rgba(108, 117, 125, 0.13);
}

.badge-low {
    color: #51b355;
    background-color: rgba(81, 179, 85, 0.14);
}

/* Detail lists */
.detail-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.9rem;
}

.detail-list .row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px dashed var(--ct-border-color, #dee2e6);
}

.detail-list .row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.detail-list .row span:first-child {
    color: var(--ct-secondary-color, #6c757d);
}

/* Bars and mini stats */
.bar-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.bar-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr) 50px;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
}

.bar-label {
    color: var(--ct-secondary-color, #6c757d);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    height: 8px;
    background-color: var(--ct-tertiary-bg, #f2f2f7);
    border-radius: 999px;
    overflow: hidden;
}

.bar-fill {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 999px;
    background-color: var(--ct-primary, #4254ba);
}

.bar-fill-alt {
    background-color: #299bf6;
}

.bar-fill-success {
    background-color: #17a497;
}

.bar-value {
    text-align: end;
    color: var(--ct-secondary-color, #6c757d);
    font-variant-numeric: tabular-nums;
}

.spark-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.45rem;
    height: 170px;
    padding-top: 0.5rem;
}

.spark-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
    gap: 0.3rem;
}

.spark-bar span {
    display: block;
    width: 100%;
    max-width: 30px;
    min-height: 3px;
    border-radius: 0.2rem 0.2rem 0 0;
    background-color: var(--ct-primary, #4254ba);
}

.spark-bar small {
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.68rem;
}

.list-rows {
    display: flex;
    flex-direction: column;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--ct-border-color, #dee2e6);
    font-size: 0.9rem;
}

.list-row:last-child {
    border-bottom: 0;
}

.grid-mini {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
    gap: 0.55rem;
}

.mini-stat {
    background-color: var(--ct-tertiary-bg, #f2f2f7);
    border-radius: 0.35rem;
    padding: 0.7rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.78rem;
    color: var(--ct-secondary-color, #6c757d);
}

.mini-stat strong {
    font-size: 1.15rem;
    color: var(--ct-body-color, #6c757d);
}

/* Timeline */
.timeline {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.timeline li {
    position: relative;
    padding: 0 0 0.9rem 1.1rem;
    border-inline-start: 2px solid var(--ct-border-color, #dee2e6);
    margin-inline-start: 0.4rem;
}

.timeline li::before {
    content: "";
    position: absolute;
    inset-inline-start: -5px;
    top: 0.35rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--ct-primary, #4254ba);
}

.timeline-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--ct-secondary-color, #6c757d);
}

.timeline-body {
    margin-top: 0.2rem;
    font-size: 0.9rem;
}

/* Kanban */
.board {
    padding-bottom: 0.5rem;
}

.board .tasks {
    vertical-align: top;
}

.tasks.drag-over {
    outline: 2px dashed var(--ct-primary, #4254ba);
    outline-offset: -3px;
}

.board-card {
    cursor: grab;
}

.board-card.dragging {
    opacity: 0.45;
}

.task-list-items::before {
    content: "";
    display: none;
}

.board-empty {
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 1rem;
    border: 1px dashed var(--ct-border-color, #dee2e6);
    border-radius: 0.45rem;
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.8rem;
}

.board-empty i {
    font-size: 1.3rem;
    opacity: 0.6;
}

.field .is-invalid {
    border-color: var(--ct-danger, #f7473a) !important;
}

.invalid-feedback.d-block {
    display: block;
    font-size: 0.8rem;
    color: var(--ct-danger, #f7473a);
}

tbody td[data-label]::before {
    content: none;
}

@media (max-width: 767.98px) {
    .table-responsive table.mobile-cards thead {
        display: none;
    }

    .table-responsive table.mobile-cards,
    .table-responsive table.mobile-cards tbody {
        display: block;
        width: 100%;
    }

    .table-responsive table.mobile-cards tbody tr {
        display: block;
        border: 1px solid var(--ct-border-color, #dee2e6);
        border-radius: 0.35rem;
        margin-bottom: 0.75rem;
        padding: 0.5rem;
        background-color: var(--ct-secondary-bg, #fff);
    }

    .table-responsive table.mobile-cards tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        border: 0;
        padding: 0.35rem 0.25rem;
        text-align: end;
    }

    .table-responsive table.mobile-cards tbody td::before {
        content: attr(data-label);
        color: var(--ct-secondary-color, #6c757d);
        font-weight: 500;
        text-align: start;
        flex-shrink: 0;
    }

    .table-responsive table.mobile-cards tbody td:empty {
        display: none;
    }

    .table-responsive table.mobile-cards tbody td[colspan] {
        justify-content: center;
        text-align: center;
    }

    .table-responsive table.mobile-cards tbody td[colspan]::before {
        content: none;
    }
}

/* Misc */
.center-card {
    max-width: 540px;
    margin: 3rem auto;
    text-align: center;
    padding: 2.2rem;
}

.tab-nav {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--ct-border-color, #dee2e6);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tab-nav a {
    padding: 0.5rem 0.7rem;
    color: var(--ct-secondary-color, #6c757d);
    border-bottom: 2px solid transparent;
    font-size: 0.88rem;
}

.tab-nav a.active {
    color: var(--ct-primary, #4254ba);
    border-color: var(--ct-primary, #4254ba);
}

.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--ct-secondary-color, #6c757d);
}

.apex-charts {
    min-height: 300px;
}

@media (max-width: 991.98px) {
    .grid-2,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .content-page .card {
        padding: 1rem;
    }
}

@media (max-width: 575.98px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .bar-row {
        grid-template-columns: 90px minmax(0, 1fr) 42px;
    }

    .page-head {
        align-items: flex-start;
    }
}


.brand-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex: 0 0 auto;
}

.logo-lg .brand-icon {
    width: 44px;
    height: 44px;
}

.logo-sm .brand-icon,
.brand-icon-sm {
    width: 36px;
    height: 36px;
}

.auth-brand-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.form-section {
    padding: 1rem 1.05rem;
    border: 1px solid var(--ct-border-color, #e4e6ef);
    border-radius: 0.7rem;
    background: var(--ct-secondary-bg, #fff);
}

.form-section + .form-section {
    margin-top: 0.9rem;
}

.form-section-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.form-section-head h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.1rem;
    color: var(--ct-body-color, #30343b);
}

.form-section-head p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--ct-secondary-color, #7a7f87);
}

.form-section-icon {
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    color: var(--ct-primary, #4254ba);
    background: rgba(66, 84, 186, 0.1);
    font-size: 1.1rem;
}

.form-note {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.8rem 0 0;
    font-size: 0.8rem;
    color: var(--ct-secondary-color, #7a7f87);
}

.entity-dialog .modal-content {
    border: 0;
    border-radius: 0.9rem;
    overflow: hidden;
    box-shadow: 0 1.5rem 3rem rgba(20, 24, 40, 0.22);
}

.entity-dialog .modal-body {
    background: var(--ct-tertiary-bg, #f5f6fa);
    padding: 1.1rem 1.3rem 1.3rem;
}

.entity-dialog-header {
    position: relative;
    overflow: hidden;
    border: 0;
    padding: 1.15rem 1.35rem;
    color: #fff;
    background: linear-gradient(135deg, #4254ba 0%, #6373d8 55%, #7e8ce6 100%);
}

.entity-dialog-header::after {
    content: "";
    position: absolute;
    width: 11rem;
    height: 11rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    top: -6rem;
    inset-inline-end: -3rem;
    pointer-events: none;
}

.entity-dialog-header .btn-close {
    filter: invert(1);
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.entity-dialog-icon {
    width: 2.7rem;
    height: 2.7rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 1.35rem;
}

.entity-dialog-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.entity-dialog .modal-body .form-section {
    box-shadow: 0 1px 2px rgba(27, 23, 30, 0.04);
}

.entity-dialog-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem 0 0.2rem;
    border-top: 1px solid var(--ct-border-color, #e4e6ef);
    background: var(--ct-tertiary-bg, #f5f6fa);
}

.entity-dialog .modal-body .form-grid {
    gap: 0.85rem;
}

.picker-dialog .modal-dialog {
    max-width: 820px;
}

.picker-dialog .modal-body {
    padding: 1rem 1.15rem 1.15rem;
}

.dialog-loading {
    min-height: 15rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    color: var(--ct-secondary-color, #7a7f87);
    font-size: 0.85rem;
}

.dialog-form-notice {
    margin-bottom: 0.8rem;
}

@media (max-width: 575.98px) {
    .entity-dialog .modal-body {
        padding: 0.85rem;
    }

    .form-section {
        padding: 0.85rem;
    }
}

/* Detail pages */
.stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-main,
.detail-side {
    min-width: 0;
}

.detail-hero {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding: 1.35rem 1.4rem;
    border: 1px solid var(--ct-border-color, #e4e6ef);
    background: linear-gradient(135deg, rgba(66, 84, 186, 0.09), rgba(66, 84, 186, 0.015));
}

.detail-hero-main {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    min-width: 0;
    flex: 1 1 420px;
}

.entity-avatar {
    width: 4rem;
    height: 4rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.1rem;
    font-size: 1.65rem;
    color: var(--ct-primary, #4254ba);
    background: rgba(66, 84, 186, 0.12);
}

.entity-avatar.lead {
    color: #2f6fed;
    background: rgba(47, 111, 237, 0.12);
}

.entity-avatar.deal {
    color: #17a497;
    background: rgba(23, 164, 151, 0.14);
}

.entity-avatar.organization {
    color: #7b61ff;
    background: rgba(123, 97, 255, 0.14);
}

.entity-avatar.contact {
    color: #c47b0b;
    background: rgba(196, 123, 11, 0.14);
}

.detail-hero-copy {
    min-width: 0;
}

.hero-eyebrow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.hero-type {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--ct-secondary-color, #6c757d);
}

.detail-hero h1 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.55rem;
    color: var(--ct-body-color, #30343b);
    word-break: break-word;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--ct-border-color, #e4e6ef);
    background: var(--ct-secondary-bg, #fff);
    color: var(--ct-body-color, #30343b);
    font-size: 0.8rem;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-chip i {
    color: var(--ct-primary, #4254ba);
    flex: 0 0 auto;
}

a.hero-chip:hover {
    border-color: var(--ct-primary, #4254ba);
    color: var(--ct-primary, #4254ba);
}

.detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-inline-start: auto;
}

.detail-actions form {
    margin: 0;
}

.detail-section {
    margin-bottom: 0;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--ct-border-color, #e4e6ef);
}

.section-icon {
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
    color: var(--ct-primary, #4254ba);
    background: rgba(66, 84, 186, 0.1);
    font-size: 1rem;
}

.section-heading h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--ct-body-color, #30343b);
}

.section-heading p {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: var(--ct-secondary-color, #6c757d);
}

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

.info-grid.one-col {
    grid-template-columns: 1fr;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-width: 0;
    padding: 0.65rem 0.7rem;
    border-radius: 0.55rem;
    background: var(--ct-tertiary-bg, #f2f2f7);
}

.info-item.full {
    grid-column: 1 / -1;
}

.info-icon {
    width: 1.9rem;
    height: 1.9rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: var(--ct-primary, #4254ba);
    background: var(--ct-secondary-bg, #fff);
    font-size: 0.95rem;
}

.info-copy {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.info-label {
    font-size: 0.73rem;
    color: var(--ct-secondary-color, #6c757d);
}

.info-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ct-body-color, #30343b);
    word-break: break-word;
    line-height: 1.4;
}

.info-value a {
    color: var(--ct-primary, #4254ba);
    text-decoration: none;
}

.info-value a:hover {
    text-decoration: underline;
}

.related-block + .related-block {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px dashed var(--ct-border-color, #e4e6ef);
}

.related-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.related-head h3 {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
    color: var(--ct-body-color, #30343b);
}

.related-head h3 i {
    color: var(--ct-primary, #4254ba);
}

.related-head a {
    font-size: 0.75rem;
    color: var(--ct-secondary-color, #6c757d);
    text-decoration: none;
}

.related-head a:hover {
    color: var(--ct-primary, #4254ba);
}

.list-row-main {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.list-row-main i {
    color: var(--ct-secondary-color, #6c757d);
    flex: 0 0 auto;
}

.list-row-main a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    padding: 1rem 0.5rem;
    text-align: center;
    color: var(--ct-secondary-color, #6c757d);
}

.empty-state i {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
    opacity: 0.7;
}

.empty-state p {
    margin: 0;
    font-size: 0.8rem;
}

.timeline-wrap {
    margin-top: -0.2rem;
}

@media (max-width: 991.98px) {
    .detail-hero {
        flex-direction: column;
    }

    .detail-actions {
        width: 100%;
        margin-inline-start: 0;
        justify-content: flex-start;
    }
}

@media (max-width: 575.98px) {
    .detail-hero {
        padding: 1rem;
    }

    .entity-avatar {
        width: 3.2rem;
        height: 3.2rem;
        border-radius: 0.85rem;
        font-size: 1.3rem;
    }

    .detail-hero h1 {
        font-size: 1.25rem;
    }

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


.list-row-main {
    flex: 1 1 auto;
    overflow: hidden;
}

.list-row > .muted {
    max-width: 48%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.description-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--ct-body-color, #30343b);
    white-space: pre-line;
}

.assignee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.45rem;
    max-height: 14rem;
    overflow-y: auto;
    padding: 0.15rem;
}

.assignee-chip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--ct-border-color, #e4e6ef);
    border-radius: 0.5rem;
    background: var(--ct-secondary-bg, #fff);
    font-size: 0.85rem;
    cursor: pointer;
}

.assignee-chip:has(input:checked) {
    border-color: var(--ct-primary, #4254ba);
    background: rgba(66, 84, 186, 0.08);
}

.assignee-chip input[type="checkbox"] {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    padding: 0;
    margin: 0;
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    box-shadow: none;
    accent-color: var(--ct-primary, #4254ba);
}

@media (max-width: 575.98px) {
    .assignee-grid {
        grid-template-columns: 1fr;
    }
}

.activity-type-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

.activity-type-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--ct-border-color, #e4e6ef);
    border-radius: 0.55rem;
    background: var(--ct-secondary-bg, #fff);
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.activity-type-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.activity-type-option:has(input:checked) {
    border-color: var(--ct-primary, #4254ba);
    background: rgba(66, 84, 186, 0.08);
}

.activity-type-option:has(input:focus-visible) {
    outline: 2px solid var(--ct-primary, #4254ba);
    outline-offset: 2px;
}

.activity-type-icon {
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: var(--ct-tertiary-bg, #f2f2f7);
    color: var(--ct-secondary-color, #6c757d);
}

.activity-type-option:has(input:checked) .activity-type-icon {
    background: var(--ct-primary, #4254ba);
    color: #fff;
}

[data-show-for][hidden] {
    display: none !important;
}

@media (max-width: 575.98px) {
    .activity-type-picker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.related-type-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

[data-related-type][hidden] {
    display: none !important;
}

.assignee-picker {
    border: 1px solid var(--ct-border-color, #e4e6ef);
    border-radius: 0.55rem;
    background: var(--ct-secondary-bg, #fff);
    padding: 0.35rem;
}

.assignee-search {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.15rem 0.3rem 0.45rem;
    border-bottom: 1px solid var(--ct-border-color, #e4e6ef);
    color: var(--ct-secondary-color, #6c757d);
}

.assignee-search input {
    width: 100%;
    padding: 0.15rem 0;
    border: 0;
    background: transparent;
    color: var(--ct-body-color, #30343b);
    font-size: 0.85rem;
}

.assignee-search input:focus {
    outline: 0;
    border: 0;
    box-shadow: none;
}

.assignee-count {
    font-size: 0.75rem;
    white-space: nowrap;
    color: var(--ct-secondary-color, #6c757d);
}

.assignee-picker .assignee-grid {
    max-height: 12rem;
    padding: 0.45rem 0.1rem 0.1rem;
}

.assignee-state {
    margin: 0.6rem 0.3rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--ct-secondary-color, #6c757d);
}

.assignee-chip[hidden] {
    display: none !important;
}

.notes-table td.note-cell {
    white-space: normal;
    min-width: 260px;
    max-width: 430px;
}

.note-preview {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 4.8em;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.note-view-content {
    white-space: pre-line;
    overflow-wrap: anywhere;
    line-height: 1.8;
    font-size: 0.92rem;
    color: var(--ct-body-color, #30343b);
}

.note-view-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--ct-border-color, #e4e6ef);
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.8rem;
}

.note-view-meta a {
    color: var(--ct-primary, #4254ba);
    text-decoration: none;
}

.note-view-meta a:hover {
    text-decoration: underline;
}

.badge:not([class*="badge-"]):not([class*="bg-"]) {
    color: var(--ct-primary, #4254ba);
    background-color: rgba(66, 84, 186, 0.12);
}

.badge-soft {
    color: var(--ct-primary, #4254ba);
    background-color: rgba(66, 84, 186, 0.12);
}

/* Dashboard */
.dash-hero {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding: 1.35rem 1.4rem;
    border: 1px solid var(--ct-border-color, #e4e6ef);
    background: linear-gradient(135deg, rgba(66, 84, 186, 0.1), rgba(66, 84, 186, 0.015));
}

.dash-hero-main {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    min-width: 0;
}

.dash-hero-icon {
    width: 3.65rem;
    height: 3.65rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    color: var(--ct-primary, #4254ba);
    background: rgba(66, 84, 186, 0.12);
    font-size: 1.5rem;
}

.dash-hero h1 {
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.35rem;
    color: var(--ct-body-color, #30343b);
}

.dash-hero p {
    margin: 0;
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.88rem;
}

.dash-hero-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-inline-start: auto;
}

.dash-filter {
    margin-top: 1rem;
}

.dash-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--ct-border-color, #e4e6ef);
}

.dash-card-title {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-width: 0;
}

.dash-card-title .section-icon {
    width: 2.2rem;
    height: 2.2rem;
}

.dash-card-title h2 {
    font-size: 0.98rem;
    font-weight: 600;
    margin: 0;
    color: var(--ct-body-color, #30343b);
}

.dash-card-title p {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    color: var(--ct-secondary-color, #6c757d);
}

.dash-filter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.dash-filter-actions {
    align-self: end;
}

.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

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

.dash-kpi {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.1rem;
    background: var(--ct-secondary-bg, #fff);
    border: 1px solid var(--ct-border-color, #e4e6ef);
}

.dash-kpi::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--kpi-accent, #4254ba), transparent);
}

.dash-kpi.accent-primary { --kpi-accent: #4254ba; --kpi-soft: rgba(66, 84, 186, 0.12); }
.dash-kpi.accent-info { --kpi-accent: #2f6fed; --kpi-soft: rgba(47, 111, 237, 0.12); }
.dash-kpi.accent-success { --kpi-accent: #17a497; --kpi-soft: rgba(23, 164, 151, 0.14); }
.dash-kpi.accent-warning { --kpi-accent: #d99a17; --kpi-soft: rgba(241, 180, 76, 0.18); }
.dash-kpi.accent-secondary { --kpi-accent: #6c757d; --kpi-soft: rgba(108, 117, 125, 0.13); }
.dash-kpi.accent-teal { --kpi-accent: #2f9e8f; --kpi-soft: rgba(47, 158, 143, 0.14); }
.dash-kpi.accent-danger { --kpi-accent: #f7473a; --kpi-soft: rgba(247, 71, 58, 0.12); }

.dash-kpi-icon {
    width: 2.6rem;
    height: 2.6rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    color: var(--kpi-accent, #4254ba);
    background: var(--kpi-soft, rgba(66, 84, 186, 0.12));
    font-size: 1.2rem;
}

.dash-kpi-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.dash-kpi-label {
    font-size: 0.76rem;
    color: var(--ct-secondary-color, #6c757d);
}

.dash-kpi-value {
    font-size: 1.32rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ct-body-color, #30343b);
    word-break: break-word;
}

.dash-kpi-hint {
    font-size: 0.72rem;
    color: var(--ct-secondary-color, #6c757d);
}

.dash-kpi-track {
    height: 0.3rem;
    margin-top: 0.35rem;
    border-radius: 999px;
    background: var(--ct-tertiary-bg, #f2f2f7);
    overflow: hidden;
}

.dash-kpi-track span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--kpi-accent, #4254ba);
}

.dash-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.dash-split {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.dash-split.even {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dash-chart-card,
.dash-side-card,
.dash-table-card {
    min-width: 0;
}

.dash-chart-card .apex-charts {
    width: 100%;
    min-height: 350px;
}

.dash-side-card .apex-charts {
    min-height: 280px;
}

.dash-activity-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.dash-activity {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.7rem;
    border-radius: 0.55rem;
    background: var(--ct-tertiary-bg, #f2f2f7);
}

.dash-activity-icon {
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: var(--ct-primary, #4254ba);
    background: var(--ct-secondary-bg, #fff);
}

.dash-activity > div {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}

.dash-activity > div span {
    font-size: 0.73rem;
    color: var(--ct-secondary-color, #6c757d);
}

.dash-activity > div strong {
    font-size: 1rem;
    color: var(--ct-body-color, #30343b);
}

.dash-activity.is-done .dash-activity-icon {
    color: #17a497;
}

.dash-rank-list,
.dash-team-list {
    display: flex;
    flex-direction: column;
}

.dash-rank-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--ct-border-color, #e4e6ef);
}

.dash-rank-row:last-child,
.dash-team-row:last-child {
    border-bottom: 0;
}

.dash-rank {
    width: 1.7rem;
    height: 1.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--ct-tertiary-bg, #f2f2f7);
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.75rem;
    font-weight: 600;
}

.dash-rank-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.dash-rank-body a {
    color: var(--ct-body-color, #30343b);
    text-decoration: none;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-rank-body a:hover {
    color: var(--ct-primary, #4254ba);
}

.dash-rank-track {
    height: 0.3rem;
    border-radius: 999px;
    background: var(--ct-tertiary-bg, #f2f2f7);
    overflow: hidden;
}

.dash-rank-track span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #4254ba, #2f6fed);
}

.dash-rank-row strong {
    font-size: 0.82rem;
    white-space: nowrap;
}

.dash-team-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--ct-border-color, #e4e6ef);
}

.dash-team-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.dash-team-body > div {
    font-size: 0.85rem;
}

.dash-team-body small {
    font-size: 0.72rem;
    color: var(--ct-secondary-color, #6c757d);
}

.dash-table-card .table {
    font-size: 0.85rem;
}

.dash-table-card .table th {
    font-size: 0.73rem;
    font-weight: 500;
    color: var(--ct-secondary-color, #6c757d);
}

.dash-table-card .table a {
    color: var(--ct-body-color, #30343b);
    text-decoration: none;
}

.dash-table-card .table a:hover {
    color: var(--ct-primary, #4254ba);
}

@media (max-width: 1199.98px) {
    .dash-chart-grid,
    .dash-split,
    .dash-split.even {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .dash-hero {
        flex-direction: column;
    }

    .dash-hero-actions {
        margin-inline-start: 0;
    }

    .dash-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dash-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 575.98px) {
    .dash-kpi-grid,
    .dash-filter-grid,
    .dash-activity-grid {
        grid-template-columns: 1fr;
    }

    .dash-hero {
        padding: 1rem;
    }

    .dash-hero h1 {
        font-size: 1.25rem;
    }

    .dash-hero-icon {
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
    }
}


@media (min-width: 1200px) {
    .dash-kpi-wide {
        grid-column: span 2;
    }
}

@media (min-width: 576px) and (max-width: 1199.98px) {
    .dash-kpi-wide {
        grid-column: span 2;
    }
}


.dash-bar-chart {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
    min-height: 300px;
}

.dash-bar-row {
    display: grid;
    grid-template-columns: minmax(100px, 135px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
}

.dash-bar-label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    font-size: 0.8rem;
    color: var(--ct-body-color, #30343b);
}

.dash-bar-label small {
    font-size: 0.68rem;
    color: var(--ct-secondary-color, #6c757d);
}

.dash-bar-track {
    height: 0.6rem;
    border-radius: 999px;
    background: var(--ct-tertiary-bg, #f2f2f7);
    overflow: hidden;
}

.dash-bar-track span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--ct-primary, #4254ba);
    transition: width 0.45s ease;
}

.dash-bar-value {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ct-body-color, #30343b);
    white-space: nowrap;
}

.stage-demo .dash-bar-track span { background: #4254ba; }
.stage-presentation .dash-bar-track span { background: #2f6fed; }
.stage-price_quote .dash-bar-track span { background: #d99a17; }
.stage-negotiation .dash-bar-track span { background: #7b61ff; }
.stage-won .dash-bar-track span { background: #17a497; }
.stage-lost .dash-bar-track span { background: #f7473a; }

.funnel-new .dash-bar-track span { background: #2f6fed; }
.funnel-contacted .dash-bar-track span { background: #d99a17; }
.funnel-qualified .dash-bar-track span { background: #4254ba; }
.funnel-unqualified .dash-bar-track span { background: #f7473a; }
.funnel-converted .dash-bar-track span { background: #17a497; }
.funnel-lost .dash-bar-track span { background: #6c757d; }

@media (max-width: 575.98px) {
    .dash-bar-row {
        grid-template-columns: 90px minmax(0, 1fr) auto;
        gap: 0.45rem;
    }

    .dash-bar-label {
        font-size: 0.74rem;
    }

    .dash-bar-value {
        font-size: 0.72rem;
    }
}

/* Activity calendar */
.calendar-card {
    padding: 1rem;
}

.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.calendar-month {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.calendar-month h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.calendar-month small {
    display: block;
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.75rem;
}

.calendar-legend {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.calendar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.72rem;
}

.calendar-legend-item i {
    color: var(--event, #4254ba);
}

.calendar-scroll {
    overflow-x: auto;
    border: 1px solid var(--ct-border-color, #e4e6ef);
    border-radius: 0.5rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    min-width: 860px;
    background: var(--ct-border-color, #e4e6ef);
    gap: 1px;
}

.calendar-weekday {
    padding: 0.55rem 0.4rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ct-secondary-color, #6c757d);
    background: var(--ct-tertiary-bg, #f2f2f7);
}

.calendar-day {
    min-height: 118px;
    padding: 0.4rem;
    background: var(--ct-secondary-bg, #fff);
    min-width: 0;
}

.calendar-day.is-empty {
    background: var(--ct-tertiary-bg, #f2f2f7);
}

.calendar-day.is-today {
    box-shadow: inset 0 0 0 2px var(--ct-primary, #4254ba);
}

.calendar-day-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.75rem;
    font-weight: 600;
}

.calendar-day-head .badge {
    font-size: 0.6rem;
    padding: 0.12rem 0.3rem;
}

.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.35rem;
    max-height: 98px;
    overflow-y: auto;
}

.calendar-event {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    padding: 0.27rem 0.35rem;
    border-inline-start: 3px solid var(--event, #4254ba);
    border-radius: 0.3rem;
    background: var(--event-soft, rgba(66, 84, 186, 0.1));
    color: var(--ct-body-color, #30343b);
    font-size: 0.68rem;
    line-height: 1.35;
    text-decoration: none;
    overflow: hidden;
}

.calendar-event:hover {
    background: var(--event-soft, rgba(66, 84, 186, 0.1));
    color: var(--ct-primary, #4254ba);
}

.calendar-event-time {
    flex: 0 0 auto;
    color: var(--event, #4254ba);
    font-weight: 600;
}

.calendar-event-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event.type-task,
.calendar-legend-item.type-task {
    --event: #4254ba;
    --event-soft: rgba(66, 84, 186, 0.1);
}

.calendar-event.type-call,
.calendar-legend-item.type-call {
    --event: #2f6fed;
    --event-soft: rgba(47, 111, 237, 0.1);
}

.calendar-event.type-meeting,
.calendar-legend-item.type-meeting {
    --event: #d99a17;
    --event-soft: rgba(241, 180, 76, 0.16);
}

.calendar-event.type-email,
.calendar-legend-item.type-email {
    --event: #17a497;
    --event-soft: rgba(23, 164, 151, 0.12);
}

.calendar-undated {
    margin-top: 1rem;
}

@media (max-width: 767.98px) {
    .calendar-toolbar {
        align-items: flex-start;
    }

    .calendar-legend {
        margin-top: 0.25rem;
    }
}

/* Attachments */
.attachments-card {
    margin-top: 1rem;
}

.attachment-form {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--ct-border-color, #e4e6ef);
    border-radius: 0.55rem;
    background: var(--ct-tertiary-bg, #f2f2f7);
}

.attachment-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.6rem;
}

.attachment-file-field input[type="file"] {
    width: 100%;
    padding: 0.35rem 0.45rem;
    border: 1px dashed var(--ct-border-color, #c9ccd6);
    border-radius: 0.45rem;
    background: var(--ct-secondary-bg, #fff);
    font-size: 0.78rem;
    color: var(--ct-secondary-color, #6c757d);
}

.attachment-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.55rem;
}

.attachment-form-actions .form-note {
    margin: 0;
    font-size: 0.7rem;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    margin-top: 0.75rem;
}

.attachment-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--ct-border-color, #e4e6ef);
}

.attachment-row:last-child {
    border-bottom: 0;
}

.attachment-icon {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: var(--ct-primary, #4254ba);
    background: var(--ct-tertiary-bg, #f2f2f7);
    font-size: 1rem;
}

.attachment-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.attachment-copy a {
    color: var(--ct-body-color, #30343b);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-copy a:hover {
    color: var(--ct-primary, #4254ba);
}

.attachment-copy small {
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.attachment-actions form {
    margin: 0;
}

@media (max-width: 575.98px) {
    .attachment-form-grid {
        grid-template-columns: 1fr;
    }

    .attachment-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .attachment-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

.attachment-preview-body {
    padding: 0;
    min-height: 240px;
    background: var(--ct-tertiary-bg, #f2f2f7);
}

.attachment-preview-image {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    margin: 0 auto;
    object-fit: contain;
}

.attachment-preview-frame {
    display: block;
    width: 100%;
    height: 70vh;
    border: 0;
    background: #fff;
}

.attachment-preview-note {
    margin: 0;
    padding: 0.75rem 1rem;
    text-align: center;
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.8rem;
    background: var(--ct-secondary-bg, #fff);
}

.channel-url {
    display: inline-block;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--ct-secondary-color, #6c757d);
}

.json-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.55;
}

.variable-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.variable-chips code {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.35rem;
    background: rgba(66, 84, 186, 0.1);
    color: var(--ct-primary, #4254ba);
    font-size: 0.8rem;
    direction: ltr;
    unicode-bidi: embed;
}

.checkbox.field {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
}

.profile-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

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

.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
}

.profile-avatar-wrap {
    margin-bottom: 0.85rem;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--ct-card-bg, #fff);
    box-shadow: 0 8px 24px rgba(24, 35, 79, 0.16);
    background: var(--ct-light, #f3f5f9);
}

.profile-name {
    margin: 0 0 0.2rem;
    font-size: 1.15rem;
}

.profile-email,
.profile-phone {
    margin: 0 0 0.35rem;
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.875rem;
}

.profile-since {
    margin-top: 0.35rem;
}

.profile-photo-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.avatar-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.profile-photo-hint {
    margin: 0.75rem 0 0;
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.75rem;
    line-height: 1.6;
}

.profile-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-main .card {
    margin: 0;
}

.backup-card {
    padding: 1rem;
    border: 1px solid var(--ct-border-color, #e7ebf3);
    border-radius: 0.65rem;
    background: var(--ct-light, #f8f9fc);
}

.backup-card h3 {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.backup-card .btn {
    margin-top: 0.35rem;
}

#settings-tab-content > .tab-pane > .card {
    margin-top: 0;
}

#settings-tabs .nav-link {
    white-space: nowrap;
}

#settings-tabs .nav-link i {
    font-size: 1rem;
}

/* Share dialog: make the target and permission steps explicit. */
.share-step {
    border: 1px solid var(--ct-border-color, #e3e6f0);
    border-radius: 10px;
    padding: 1rem;
}

.share-step legend {
    float: none;
    width: auto;
    padding: 0 0.35rem;
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: 0;
}

.share-type-card,
.share-permission-option {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.75rem;
    border: 1px solid var(--ct-border-color, #e3e6f0);
    border-radius: 8px;
    cursor: pointer;
    background: var(--ct-card-bg, #fff);
}

.share-type-card input,
.share-permission-option input {
    margin-top: 0.2rem;
    flex: 0 0 auto;
}

.share-type-card span,
.share-permission-option span {
    font-weight: 600;
}

.share-type-card:has(input:checked),
.share-permission-option:has(input:checked) {
    border-color: var(--ct-primary, #727cf5);
    background: rgba(114, 124, 245, 0.08);
}

.share-summary {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    background: var(--ct-light, #f6f7fb);
    color: var(--ct-body-color, #313a46);
    font-weight: 500;
}

.searchable-select {
    position: relative;
}

.searchable-select-native {
    display: none !important;
}

.searchable-select-menu {
    position: absolute;
    z-index: 1085;
    inset-inline: 0;
    top: calc(100% + 2px);
    max-height: 280px;
    overflow-y: auto;
    padding: 0.3rem;
    background: var(--ct-card-bg, #fff);
    border: 1px solid var(--ct-border-color, #e3e6f0);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.searchable-select-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    text-align: start;
    cursor: pointer;
}

.searchable-select-item:hover,
.searchable-select-item.is-active {
    background: rgba(114, 124, 245, 0.1);
}

.searchable-select-item.is-selected {
    font-weight: 600;
}

.searchable-select-empty {
    padding: 0.6rem;
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.85rem;
}

.record-number {
    display: inline-block;
    min-width: 2.6rem;
    color: var(--ct-secondary-color, #6c757d);
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.sort-link {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.sort-link:hover {
    color: var(--ct-primary, #727cf5);
}
