.crm-kanban-page {
    --crm-primary-950: #0a1a4a;
    --crm-primary-900: #0f2261;
    --crm-primary-800: #17368d;
    --crm-primary-700: #1e45a8;
    --crm-primary-600: #2a58c0;
    --crm-secondary-400: #93c0e7;
    --crm-secondary-300: #9cc7e7;
    --crm-secondary-100: #d8ecf7;
    --crm-secondary-50: #eef6fc;
    --crm-accent-500: #00c9a7;
    --crm-accent-100: #d4fbf4;
    --crm-success-500: #00c97b;
    --crm-success-100: #d1fae5;
    --crm-warning-500: #f5a623;
    --crm-warning-100: #fef3c7;
    --crm-error-500: #e53e6b;
    --crm-error-100: #fee2e2;
    --crm-info-500: #3a6dd6;
    --crm-info-100: #dbeafe;
    --crm-neutral-950: #09111f;
    --crm-neutral-900: #0f1729;
    --crm-neutral-800: #1a2340;
    --crm-neutral-700: #2d3756;
    --crm-neutral-600: #47516e;
    --crm-neutral-500: #6b7694;
    --crm-neutral-400: #9098b0;
    --crm-neutral-300: #b4bace;
    --crm-neutral-200: #d4d8e6;
    --crm-neutral-100: #e8ebf2;
    --crm-neutral-50: #f4f5f9;
    --crm-surface: #fefefe;
    --crm-surface-soft: #fbfcff;
    --crm-shadow-sm: 0 8px 16px rgba(15, 34, 97, 0.07);
    --crm-shadow-md: 0 16px 30px rgba(15, 34, 97, 0.11);
    --crm-shadow-lg: 0 26px 54px rgba(15, 34, 97, 0.14);
    --crm-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --crm-stage-header-height: 5rem;
    --crm-stage-create-height: 3.25rem;
    font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
    color: var(--crm-neutral-900);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.fi-main:has(.crm-kanban-page),
.fi-page:has(.crm-kanban-page),
.fi-page:has(.crm-kanban-page) .fi-page-content,
.fi-page:has(.crm-kanban-page) .fi-page-main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.crm-kanban-shell {
    position: relative;
    display: grid;
    gap: 1.1rem;
    width: min(100%, 118rem);
    max-width: 118rem;
    min-width: 0;
    margin-inline: auto;
}

.crm-kanban-shell::before {
    content: "";
    position: absolute;
    top: -2.5rem;
    right: -3rem;
    width: 22rem;
    height: 22rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(156, 199, 231, 0.34), transparent 72%);
    filter: blur(8px);
    pointer-events: none;
}

.crm-kanban-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.crm-kanban-loading-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(156, 199, 231, 0.18), transparent 26rem),
        rgba(10, 26, 74, 0.48);
    backdrop-filter: blur(5px);
}

.crm-kanban-loading-panel {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 1rem;
    width: min(26rem, calc(100% - 2rem));
    max-width: 100%;
    padding: 1.5rem;
    border: 1px solid rgba(156, 199, 231, 0.28);
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 32px 64px rgba(15, 34, 97, 0.24);
    text-align: center;
    animation: crm-loading-panel-in 0.22s var(--crm-ease);
}

.crm-kanban-loading-copy strong {
    display: block;
    margin: 0;
    color: var(--crm-neutral-900);
    font-size: 1rem;
}

.crm-kanban-loading-panel .crm-kanban-eyebrow {
    margin-bottom: 0.45rem;
    color: var(--crm-primary-700);
}

.crm-kanban-loading-copy p {
    margin: 0.45rem 0 0;
    color: var(--crm-neutral-500);
}

.crm-kanban-loading-copy p:last-child {
    color: var(--crm-neutral-500);
    line-height: 1.55;
}

.crm-kanban-loading-spinner {
    position: relative;
    width: 4.4rem;
    height: 4.4rem;
}

.crm-kanban-loading-spinner span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: 3px solid transparent;
    border-top-color: var(--crm-primary-800);
    border-right-color: rgba(23, 54, 141, 0.2);
    animation: crm-spin 1s linear infinite;
}

.crm-kanban-loading-spinner span:nth-child(2) {
    inset: 0.42rem;
    border-top-color: var(--crm-accent-500);
    border-right-color: rgba(0, 201, 167, 0.16);
    animation-duration: 1.3s;
    animation-direction: reverse;
}

.crm-kanban-loading-spinner span:nth-child(3) {
    inset: 0.92rem;
    border-top-color: var(--crm-secondary-400);
    border-right-color: rgba(147, 192, 231, 0.12);
    animation-duration: 1.6s;
}

.crm-kanban-hero,
.crm-kanban-filters,
.crm-kanban-zero,
.crm-modal-panel,
.crm-drawer-panel {
    position: relative;
    overflow: hidden;
    background: var(--crm-surface);
    border: 1px solid rgba(147, 192, 231, 0.24);
    border-radius: 1.5rem;
    box-shadow: var(--crm-shadow-sm);
}

.crm-kanban-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) auto;
    align-items: center;
    gap: 1.2rem;
    padding: 1.15rem 1.35rem;
    background:
        radial-gradient(circle at top right, rgba(46, 232, 200, 0.16), transparent 24rem),
        linear-gradient(135deg, var(--crm-neutral-900) 0%, var(--crm-primary-950) 48%, var(--crm-primary-800) 100%);
    color: #fff;
    box-shadow: var(--crm-shadow-lg);
}

.crm-kanban-hero-compact {
    grid-template-columns: 1fr;
    justify-items: end;
    min-height: auto;
}

.crm-kanban-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.crm-kanban-hero-copy {
    max-width: 30rem;
    min-width: 0;
}

.crm-kanban-hero-copy h1,
.crm-modal-copy h3,
.crm-drawer-header h3,
.crm-kanban-zero h3,
.crm-section-heading h4 {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 1.8rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
    font-weight: 800;
}

.crm-kanban-hero-copy p,
.crm-modal-copy p,
.crm-drawer-header p,
.crm-kanban-zero p,
.crm-section-heading p {
    margin: 0.55rem 0 0;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.55;
}

.crm-kanban-zero p,
.crm-section-heading p,
.crm-drawer-header p {
    color: var(--crm-neutral-500);
}

.crm-kanban-eyebrow {
    margin: 0 0 0.6rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--crm-secondary-300);
}

.crm-kanban-hero-actions,
.crm-modal-actions,
.crm-form-actions,
.crm-entity-actions,
.crm-drawer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.crm-kanban-hero-actions {
    justify-self: end;
    align-self: center;
}

.crm-view-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
}

.crm-view-switcher button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0.55rem 0.9rem;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.18s var(--crm-ease), color 0.18s var(--crm-ease), box-shadow 0.18s var(--crm-ease);
}

.crm-view-switcher button.is-active {
    background: #fff;
    color: var(--crm-neutral-900);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
}

.crm-btn,
.crm-icon-btn,
.crm-filter-pill,
.crm-filter-clear,
.crm-kanban-stage-create {
    border: 0;
    text-decoration: none;
    transition:
        transform 0.18s var(--crm-ease),
        box-shadow 0.18s var(--crm-ease),
        border-color 0.18s var(--crm-ease),
        background 0.18s var(--crm-ease),
        color 0.18s var(--crm-ease);
}

.crm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.85rem;
    padding: 0.76rem 1.1rem;
    border-radius: 0.95rem;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}

.crm-btn:hover,
.crm-icon-btn:hover,
.crm-filter-pill:hover,
.crm-filter-clear:hover,
.crm-kanban-stage-create:hover {
    transform: translateY(-1px);
}

.crm-btn-primary {
    background: #fff;
    color: var(--crm-neutral-900);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
}

.crm-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.crm-modal-panel .crm-btn-secondary,
.crm-drawer-panel .crm-btn-secondary,
.crm-kanban-zero .crm-btn-primary,
.crm-entity-card .crm-btn-secondary {
    background: var(--crm-neutral-50);
    color: var(--crm-neutral-800);
    border: 1px solid var(--crm-neutral-200);
    box-shadow: none;
}

.crm-btn-danger {
    background: var(--crm-error-100);
    color: var(--crm-error-500);
}

.crm-kanban-filters {
    padding: 1.2rem;
    background:
        linear-gradient(180deg, rgba(238, 246, 252, 0.95) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.crm-kanban-filter-grid,
.crm-drawer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.crm-kanban-filter-grid > *,
.crm-drawer-grid > * {
    min-width: 0;
}

.crm-kanban-filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 1rem 1.25rem;
    margin-top: 1rem;
}

.crm-kanban-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    min-width: 0;
}

.crm-kanban-filter-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 0.85rem;
    min-width: 0;
    max-width: min(100%, 25rem);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--crm-neutral-500);
    text-align: right;
    justify-self: end;
}

.crm-kanban-filter-meta span {
    margin: 0;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
}

.crm-field {
    display: grid;
    gap: 0.38rem;
    min-width: 0;
}

.crm-field span,
.crm-info-card span,
.crm-kanban-card-label,
.crm-entity-card small,
.crm-timeline-meta,
.crm-task-meta {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--crm-neutral-500);
}

.crm-field input,
.crm-field select,
.crm-field textarea {
    width: 100%;
    min-height: 3rem;
    padding: 0.88rem 0.95rem;
    border: 1.5px solid rgba(180, 186, 206, 0.48);
    border-radius: 1rem;
    background: var(--crm-surface);
    color: var(--crm-neutral-900);
    font-size: 0.93rem;
    line-height: 1.5;
}

.crm-field textarea {
    min-height: 7rem;
    resize: vertical;
}

.crm-field input:focus,
.crm-field select:focus,
.crm-field textarea:focus,
.crm-btn:focus-visible,
.crm-icon-btn:focus-visible,
.crm-view-switcher button:focus-visible,
.crm-filter-pill:focus-visible,
.crm-filter-clear:focus-visible,
.crm-kanban-card:focus-visible,
.crm-opportunity-row-main:focus-visible,
.crm-list-stage-select:focus-visible,
.crm-kanban-stage-create:focus-visible {
    outline: none;
    border-color: rgba(42, 88, 192, 0.55);
    box-shadow: 0 0 0 4px rgba(42, 88, 192, 0.12);
}

.crm-field-full {
    grid-column: 1 / -1;
}

.crm-field-error {
    color: var(--crm-error-500);
    font-size: 0.76rem;
    font-weight: 700;
}

.crm-client-panel {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(147, 192, 231, 0.28);
    border-radius: 1.2rem;
    background: linear-gradient(180deg, rgba(238, 246, 252, 0.84), rgba(255, 255, 255, 0.96));
}

.crm-client-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.85rem;
    align-items: end;
}

.crm-client-search-field {
    min-width: 0;
}

.crm-client-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.crm-client-panel-eyebrow {
    display: inline-flex;
    margin-bottom: 0.2rem;
    color: var(--crm-primary-700);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.crm-client-panel-header strong,
.crm-inline-section-heading strong {
    color: var(--crm-neutral-900);
    font-size: 1rem;
    font-weight: 800;
}

.crm-client-panel-header p,
.crm-inline-section-heading p {
    margin: 0.35rem 0 0;
    color: var(--crm-neutral-600);
    font-size: 0.84rem;
    line-height: 1.55;
}

.crm-client-actions,
.crm-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.crm-client-actions {
    align-items: end;
}

.crm-client-actions .crm-btn {
    min-width: 9.5rem;
}

.crm-client-actions .crm-btn-secondary.is-active {
    background: var(--crm-primary-800);
    color: #fff;
    border-color: var(--crm-primary-800);
    box-shadow: 0 12px 24px rgba(23, 54, 141, 0.18);
}

.crm-inline-actions {
    justify-content: flex-start;
}

.crm-client-lookup {
    display: grid;
    gap: 0.85rem;
}

.crm-client-feedback {
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(212, 216, 230, 0.9);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--crm-shadow-sm);
}

.crm-client-feedback.is-success {
    border-color: rgba(0, 201, 123, 0.24);
    background: linear-gradient(180deg, rgba(209, 250, 229, 0.44), rgba(255, 255, 255, 0.98));
}

.crm-client-feedback.is-warning {
    border-color: rgba(245, 166, 35, 0.3);
    background: linear-gradient(180deg, rgba(254, 243, 199, 0.52), rgba(255, 255, 255, 0.98));
}

.crm-client-feedback.is-info {
    border-color: rgba(58, 109, 214, 0.22);
    background: linear-gradient(180deg, rgba(219, 234, 254, 0.46), rgba(255, 255, 255, 0.98));
}

.crm-client-feedback-copy {
    display: grid;
    gap: 0.25rem;
}

.crm-client-feedback-copy strong {
    color: var(--crm-neutral-900);
    font-size: 1rem;
    font-weight: 800;
}

.crm-client-feedback-copy p {
    margin: 0;
    color: var(--crm-neutral-600);
    font-size: 0.84rem;
    line-height: 1.55;
}

.crm-client-feedback-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.crm-client-feedback-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 1.85rem;
    padding: 0.18rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 34, 97, 0.06);
    color: var(--crm-primary-900);
    font-size: 0.73rem;
    font-weight: 800;
}

.crm-inline-section-heading {
    display: grid;
    gap: 0.2rem;
    padding: 0.95rem 1rem;
    border: 1px dashed rgba(147, 192, 231, 0.46);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.88);
}

.crm-filter-pill,
.crm-filter-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.66rem 0.95rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(147, 192, 231, 0.4);
    color: var(--crm-neutral-700);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.crm-filter-pill.is-active {
    background: var(--crm-primary-800);
    border-color: var(--crm-primary-800);
    color: #fff;
    box-shadow: 0 12px 24px rgba(23, 54, 141, 0.18);
}

.crm-filter-clear {
    background: transparent;
}

.crm-opportunity-list {
    display: grid;
    gap: 0.75rem;
}

.crm-opportunity-row,
.crm-opportunity-empty {
    background: var(--crm-surface);
    border: 1px solid rgba(212, 216, 230, 0.92);
    border-radius: 0.5rem;
    box-shadow: var(--crm-shadow-sm);
}

.crm-opportunity-row {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(13rem, 0.7fr) minmax(12rem, 0.65fr) minmax(12rem, auto);
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    transition: border-color 0.18s var(--crm-ease), box-shadow 0.18s var(--crm-ease), transform 0.18s var(--crm-ease);
}

.crm-opportunity-row:hover {
    border-color: rgba(147, 192, 231, 0.82);
    box-shadow: var(--crm-shadow-md);
    transform: translateY(-1px);
}

.crm-opportunity-row-main {
    display: grid;
    gap: 0.58rem;
    min-width: 0;
    border-radius: 0.5rem;
    cursor: pointer;
}

.crm-opportunity-title-line {
    display: flex;
    align-items: flex-start;
    gap: 0.78rem;
    min-width: 0;
}

.crm-opportunity-title-line > div {
    min-width: 0;
}

.crm-opportunity-title-line h3 {
    margin: 0;
    color: var(--crm-neutral-900);
    font-size: 1rem;
    line-height: 1.3;
    font-weight: 800;
}

.crm-opportunity-title-line p {
    margin: 0.22rem 0 0;
    color: var(--crm-neutral-600);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.4;
}

.crm-opportunity-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem 0.7rem;
    min-width: 0;
    color: var(--crm-neutral-500);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.4;
}

.crm-opportunity-row-meta span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.crm-opportunity-row-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    min-width: 0;
}

.crm-opportunity-row-metrics > div,
.crm-opportunity-row-stage {
    min-width: 0;
}

.crm-opportunity-row-metrics strong {
    display: block;
    margin-top: 0.22rem;
    color: var(--crm-neutral-900);
    font-size: 0.92rem;
    line-height: 1.35;
}

.crm-opportunity-row-stage {
    display: grid;
    gap: 0.45rem;
}

.crm-opportunity-stage-stack {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
}

.crm-list-stage-select {
    width: 100%;
    min-height: 2.55rem;
    padding: 0.62rem 0.75rem;
    border: 1.5px solid rgba(180, 186, 206, 0.5);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--crm-neutral-900);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
}

.crm-list-stage-select:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.crm-opportunity-row-footer {
    display: grid;
    justify-items: end;
    gap: 0.75rem;
    min-width: 0;
}

.crm-list-open-btn {
    min-height: 2.45rem;
    padding: 0.58rem 0.9rem;
}

.crm-list-sale-btn {
    min-height: 2.45rem;
    padding: 0.58rem 0.9rem;
    background: linear-gradient(135deg, #123c8c, #1d4ed8);
    color: #fff;
    box-shadow: 0 10px 20px rgba(29, 78, 216, 0.22);
}

.crm-opportunity-empty {
    display: grid;
    place-items: center;
    min-height: 10rem;
    padding: 1.5rem;
    color: var(--crm-neutral-500);
    font-weight: 700;
    text-align: center;
}

.crm-kanban-board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: clamp(21rem, 23vw, 23.5rem);
    gap: clamp(0.9rem, 1vw, 1.15rem);
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.15rem 0.9rem 0.65rem 0.15rem;
    margin-inline: -0.15rem;
    scroll-padding-inline-start: 0.15rem;
    scroll-padding-inline-end: 0.9rem;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}

.crm-kanban-board::-webkit-scrollbar {
    height: 0.55rem;
}

.crm-kanban-board::-webkit-scrollbar-thumb {
    background: rgba(107, 118, 148, 0.45);
    border-radius: 999px;
}

.crm-kanban-stage {
    display: grid;
    grid-template-rows: var(--crm-stage-header-height) minmax(18rem, 1fr);
    min-height: clamp(34rem, calc(100vh - 18rem), 46rem);
    gap: 0.8rem;
    min-width: 0;
    scroll-snap-align: start;
}

.crm-kanban-stage:has(.crm-kanban-stage-create) {
    grid-template-rows: var(--crm-stage-header-height) minmax(18rem, 1fr) var(--crm-stage-create-height);
}

.crm-kanban-stage-header,
.crm-kanban-card,
.crm-info-card,
.crm-entity-card,
.crm-drawer-empty,
.crm-kanban-empty {
    background: var(--crm-surface);
    border: 1px solid rgba(212, 216, 230, 0.9);
    border-radius: 1.25rem;
}

.crm-kanban-stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    height: var(--crm-stage-header-height);
    min-width: 0;
    padding: 1rem 1rem 1rem 1.05rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 255, 0.92) 100%);
    box-shadow: var(--crm-shadow-sm);
}

.crm-kanban-stage.is-closing .crm-kanban-stage-header {
    border-color: rgba(229, 62, 107, 0.24);
}

.crm-kanban-stage-title,
.crm-kanban-owner {
    display: flex;
    align-items: center;
    gap: 0.82rem;
    min-width: 0;
}

.crm-kanban-stage-title > div,
.crm-kanban-owner > div,
.crm-kanban-card-heading {
    min-width: 0;
}

.crm-kanban-stage-title h3,
.crm-kanban-card h4,
.crm-entity-card h4 {
    margin: 0;
    color: var(--crm-neutral-900);
    font-size: 0.98rem;
    line-height: 1.3;
}

.crm-kanban-stage-title p,
.crm-kanban-card p,
.crm-entity-card p,
.crm-drawer-empty,
.crm-kanban-empty {
    margin: 0.24rem 0 0;
    color: var(--crm-neutral-500);
    line-height: 1.45;
}

.crm-kanban-stage-dot {
    width: 0.88rem;
    height: 0.88rem;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--crm-stage-color);
    box-shadow: 0 0 0 0.38rem color-mix(in srgb, var(--crm-stage-color) 18%, transparent);
}

.crm-kanban-stage-summary {
    display: grid;
    gap: 0.35rem;
    justify-items: end;
    min-width: 0;
    text-align: right;
}

.crm-kanban-stage-summary strong {
    font-size: 0.96rem;
    color: var(--crm-primary-900);
    white-space: nowrap;
}

.crm-kanban-stage-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.65rem;
    padding: 0.18rem 0.65rem;
    border-radius: 999px;
    background: var(--crm-error-100);
    color: var(--crm-error-500);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.crm-kanban-stage-body {
    display: grid;
    gap: 0.8rem;
    align-content: start;
    min-height: 18rem;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.12rem;
    border-radius: 1.15rem;
    transition: background 0.2s var(--crm-ease), box-shadow 0.2s var(--crm-ease);
}

.crm-kanban-stage-body.is-over {
    background: linear-gradient(180deg, rgba(23, 54, 141, 0.06), rgba(23, 54, 141, 0.1));
    box-shadow: inset 0 0 0 2px rgba(23, 54, 141, 0.28);
}

.crm-kanban-stage.is-closing .crm-kanban-stage-body.is-over {
    background: linear-gradient(180deg, rgba(229, 62, 107, 0.07), rgba(229, 62, 107, 0.11));
    box-shadow: inset 0 0 0 2px rgba(229, 62, 107, 0.26);
}

.crm-kanban-card {
    position: relative;
    display: grid;
    gap: 0.82rem;
    padding: 1rem;
    border-color: rgba(212, 216, 230, 0.78);
    box-shadow: var(--crm-shadow-sm);
    cursor: grab;
    user-select: none;
    transform-origin: center;
    transition:
        transform 0.2s var(--crm-ease),
        box-shadow 0.2s var(--crm-ease),
        border-color 0.2s var(--crm-ease),
        opacity 0.2s var(--crm-ease),
        background 0.2s var(--crm-ease);
}

.crm-kanban-card:hover,
.crm-kanban-card:focus-visible {
    border-color: rgba(147, 192, 231, 0.82);
    box-shadow: var(--crm-shadow-md);
    transform: translateY(-2px);
}

.crm-kanban-card.is-pressing {
    transform: translateY(-4px) scale(1.01);
    border-color: rgba(23, 54, 141, 0.25);
    box-shadow: var(--crm-shadow-md);
}

.crm-kanban-card.is-dragging-source {
    transform: rotate(1.2deg) scale(1.02);
    border-color: rgba(23, 54, 141, 0.35);
    box-shadow: 0 30px 44px rgba(15, 34, 97, 0.22);
    opacity: 0.38;
    cursor: grabbing;
}

.crm-kanban-card-ghost {
    box-shadow: 0 28px 56px rgba(15, 34, 97, 0.22);
    transform: rotate(2deg) scale(1.02);
}

body.crm-kanban-is-dragging .crm-kanban-card,
body.crm-kanban-is-dragging .crm-kanban-card * {
    cursor: grabbing !important;
}

.crm-kanban-card-top,
.crm-kanban-card-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
}

.crm-kanban-card-badges {
    display: grid;
    justify-items: end;
    gap: 0.4rem;
    flex-shrink: 0;
}

.crm-kanban-card-company {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--crm-neutral-700);
}

.crm-kanban-card-meta {
    min-height: 2.5rem;
    font-size: 0.81rem;
}

.crm-kanban-card-segment {
    display: flex;
    align-items: center;
}

.crm-kanban-status-badge,
.crm-kanban-temp,
.crm-kanban-badge,
.crm-kanban-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.8rem;
    max-width: 100%;
    padding: 0.22rem 0.72rem;
    border-radius: 999px;
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.crm-kanban-status-badge {
    background: rgba(10, 26, 74, 0.06);
    color: var(--crm-primary-900);
}

.crm-kanban-status-lead {
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

.crm-kanban-status-qualificado,
.crm-kanban-status-qual {
    background: rgba(58, 109, 214, 0.13);
    color: #1d4ed8;
}

.crm-kanban-status-proposta,
.crm-kanban-status-prop {
    background: rgba(156, 199, 231, 0.26);
    color: var(--crm-primary-800);
}

.crm-kanban-status-negociacao,
.crm-kanban-status-neg {
    background: rgba(245, 166, 35, 0.18);
    color: #b45309;
}

.crm-kanban-status-ganho,
.crm-kanban-status-win {
    background: rgba(0, 201, 123, 0.16);
    color: #047857;
}

.crm-kanban-status-perdido,
.crm-kanban-status-lost {
    background: rgba(229, 62, 107, 0.15);
    color: var(--crm-error-500);
}

.crm-kanban-temp-hot {
    background: var(--crm-error-100);
    color: var(--crm-error-500);
}

.crm-kanban-temp-warm {
    background: var(--crm-warning-100);
    color: #b45309;
}

.crm-kanban-temp-cool {
    background: var(--crm-info-100);
    color: var(--crm-info-500);
}

.crm-kanban-badge {
    background: var(--crm-primary-950);
    color: #fff;
}

.crm-kanban-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.crm-kanban-chip {
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--crm-secondary-50);
    color: var(--crm-primary-900);
    border: 1px solid rgba(147, 192, 231, 0.34);
}

.crm-kanban-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.crm-kanban-card-grid strong,
.crm-kanban-owner strong,
.crm-info-card strong,
.crm-entity-card strong {
    display: block;
    margin-top: 0.22rem;
    color: var(--crm-neutral-900);
}

.crm-kanban-owner span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--crm-primary-800), var(--crm-primary-600));
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    box-shadow: 0 10px 18px rgba(23, 54, 141, 0.22);
}

.crm-kanban-card-grip {
    display: inline-flex;
    flex-direction: column;
    gap: 0.22rem;
    align-self: center;
}

.crm-kanban-card-grip span {
    width: 1.45rem;
    height: 2px;
    border-radius: 999px;
    background: rgba(107, 118, 148, 0.55);
}

.crm-kanban-empty,
.crm-drawer-empty,
.crm-kanban-zero {
    display: grid;
    place-items: center;
    text-align: center;
}

.crm-kanban-empty {
    min-height: 100%;
    padding: 1rem;
    border-style: dashed;
    background: rgba(255, 255, 255, 0.74);
}

.crm-kanban-stage-create {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: var(--crm-stage-create-height);
    min-height: var(--crm-stage-create-height);
    padding: 0 1rem;
    border-radius: 1rem;
    background: transparent;
    border: 1.5px dashed rgba(107, 118, 148, 0.34);
    color: var(--crm-neutral-600);
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
}

.crm-kanban-stage-create:hover {
    background: rgba(23, 54, 141, 0.05);
    border-color: rgba(23, 54, 141, 0.48);
    color: var(--crm-primary-800);
}

.crm-info-card,
.crm-entity-card,
.crm-drawer-empty,
.crm-kanban-zero,
.crm-drawer-form,
.crm-drawer-section {
    padding: 1rem;
}

.crm-drawer-section,
.crm-drawer-form {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.94));
    border: 1px solid rgba(212, 216, 230, 0.9);
    border-radius: 1.2rem;
    box-shadow: var(--crm-shadow-sm);
}

.crm-info-card {
    display: grid;
    align-content: start;
    min-height: 6rem;
}

.crm-section-heading {
    margin-bottom: 0.95rem;
}

.crm-section-heading h4 {
    font-size: 1rem;
}

.crm-drawer-stack {
    display: grid;
    gap: 1rem;
}

.crm-entity-list,
.crm-timeline-list {
    display: grid;
    gap: 0.85rem;
}

.crm-entity-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--crm-shadow-sm);
}

.crm-product-code {
    display: inline-flex;
    align-items: center;
    min-height: 1.7rem;
    margin-top: 0.35rem;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    background: var(--crm-secondary-50);
    color: var(--crm-primary-900);
    font-size: 0.72rem;
    font-weight: 800;
}

.crm-entity-actions {
    flex-shrink: 0;
}

.crm-modal-actions,
.crm-form-actions {
    margin-top: 1rem;
}

.crm-modal-actions {
    justify-content: flex-end;
}

.crm-modal-root,
.crm-drawer-root {
    position: fixed;
    inset: 0;
    z-index: 60;
}

.crm-modal-backdrop,
.crm-drawer-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(10, 26, 74, 0.5);
    backdrop-filter: blur(3px);
    animation: crm-fade-in 0.22s var(--crm-ease);
}

.crm-modal-panel,
.crm-drawer-panel {
    position: absolute;
    background: var(--crm-surface);
    animation: crm-panel-in 0.24s var(--crm-ease);
}

.crm-modal-panel {
    top: 50%;
    left: 50%;
    width: min(34rem, calc(100% - 2rem));
    max-width: calc(100% - 2rem);
    padding: 1.2rem;
    transform: translate(-50%, -50%);
}

.crm-sale-modal-panel {
    width: min(58rem, calc(100% - 2rem));
    max-height: min(90dvh, 52rem);
    overflow-y: auto;
}

.crm-sale-summary,
.crm-sale-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.crm-sale-summary > div,
.crm-sale-totals > div {
    min-width: 0;
    padding: 0.85rem;
    border: 1px solid rgba(212, 216, 230, 0.9);
    border-radius: 0.75rem;
    background: var(--crm-neutral-50);
}

.crm-sale-summary span,
.crm-sale-totals span,
.crm-sale-item span {
    display: block;
    color: var(--crm-neutral-500);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.crm-sale-summary strong,
.crm-sale-totals strong,
.crm-sale-item strong {
    display: block;
    margin-top: 0.22rem;
    color: var(--crm-neutral-900);
    line-height: 1.35;
}

.crm-sale-alert {
    display: grid;
    gap: 0.35rem;
    margin-top: 1rem;
    padding: 0.85rem;
    border: 1px solid rgba(229, 62, 107, 0.24);
    border-radius: 0.75rem;
    background: var(--crm-error-100);
    color: var(--crm-error-500);
    font-size: 0.84rem;
    font-weight: 700;
}

.crm-sale-alert p {
    margin: 0;
}

.crm-sale-items {
    display: grid;
    gap: 0.65rem;
    margin-top: 1rem;
}

.crm-sale-item {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(7rem, 0.6fr));
    gap: 0.75rem;
    align-items: center;
    padding: 0.85rem;
    border: 1px solid rgba(212, 216, 230, 0.9);
    border-radius: 0.75rem;
    background: #fff;
}

.crm-sale-item.has-error {
    border-color: rgba(229, 62, 107, 0.26);
    background: linear-gradient(180deg, rgba(254, 226, 226, 0.5), #fff);
}

.crm-sale-item h4,
.crm-sale-item p {
    margin: 0;
}

.crm-sale-item h4 {
    color: var(--crm-neutral-900);
    font-size: 0.95rem;
    line-height: 1.35;
}

.crm-sale-item p,
.crm-sale-item small {
    color: var(--crm-neutral-500);
    font-size: 0.78rem;
    font-weight: 700;
}

.crm-drawer-panel {
    top: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    width: min(64rem, calc(100% - 1.5rem));
    max-width: calc(100% - 1.5rem);
    border-radius: 1.45rem;
    overflow: hidden;
    box-shadow: 0 32px 68px rgba(15, 34, 97, 0.2);
}

.crm-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 1rem;
    background: linear-gradient(180deg, rgba(244, 245, 249, 0.92), rgba(255, 255, 255, 0.98));
    border-bottom: 1px solid rgba(212, 216, 230, 0.9);
}

.crm-drawer-header-copy {
    max-width: 24rem;
}

.crm-drawer-tabs {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding: 0.85rem 1.25rem 0;
    background: linear-gradient(180deg, rgba(244, 245, 249, 0.85), rgba(255, 255, 255, 0.96));
}

.crm-drawer-tabs button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.45rem;
    padding: 0.58rem 0.92rem;
    border-radius: 999px;
    border: 1px solid rgba(212, 216, 230, 0.92);
    background: #fff;
    color: var(--crm-neutral-600);
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
    transition: all 0.18s var(--crm-ease);
}

.crm-drawer-tabs button.is-active {
    background: var(--crm-primary-800);
    color: #fff;
    border-color: var(--crm-primary-800);
    box-shadow: 0 12px 24px rgba(23, 54, 141, 0.2);
}

.crm-drawer-body {
    display: grid;
    gap: 1rem;
    height: calc(100% - 10.8rem);
    overflow-y: auto;
    padding: 1rem 1.25rem 1.25rem;
    background: linear-gradient(180deg, rgba(244, 245, 249, 0.92), rgba(248, 250, 255, 0.98));
}

.crm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 0.95rem;
    background: #fff;
    color: var(--crm-neutral-700);
    font-size: 1.4rem;
    cursor: pointer;
}

.crm-timeline-list {
    position: relative;
    padding-left: 0.45rem;
}

.crm-timeline-item {
    position: relative;
    display: grid;
    gap: 0.45rem;
    padding: 0 0 0.95rem 1.4rem;
    border-left: 2px solid rgba(212, 216, 230, 0.92);
}

.crm-timeline-item:last-child {
    padding-bottom: 0;
    border-left-color: transparent;
}

.crm-timeline-item::before {
    content: "";
    position: absolute;
    top: 0.2rem;
    left: -0.45rem;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 999px;
    background: #fff;
    border: 2px solid var(--crm-primary-700);
}

.crm-timeline-item.is-email::before {
    border-color: var(--crm-info-500);
}

.crm-timeline-item.is-ligacao::before {
    border-color: #7c3aed;
}

.crm-timeline-item.is-visita::before {
    border-color: var(--crm-accent-500);
}

.crm-timeline-item.is-observacao::before,
.crm-timeline-item.is-movimento::before {
    border-color: var(--crm-neutral-400);
}

.crm-timeline-meta {
    margin: 0;
    line-height: 1.45;
}

.crm-timeline-body {
    display: grid;
    gap: 0.5rem;
}

.crm-timeline-body p,
.crm-timeline-body small {
    margin: 0;
    color: var(--crm-neutral-700);
    line-height: 1.52;
}

.crm-task-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.7rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crm-task-status-pendente {
    background: var(--crm-warning-100);
    color: #b45309;
}

.crm-task-status-em-andamento,
.crm-task-status-em_andamento {
    background: var(--crm-info-100);
    color: var(--crm-info-500);
}

.crm-task-status-concluida {
    background: var(--crm-success-100);
    color: #047857;
}

@keyframes crm-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes crm-panel-in {
    from {
        opacity: 0;
        transform: translate3d(0, 1rem, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes crm-loading-panel-in {
    from {
        opacity: 0;
        transform: translate3d(0, 1rem, 0) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes crm-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (min-width: 1280px) {
    .crm-kanban-shell {
        max-width: 122rem;
        gap: 1.25rem;
    }

    .crm-kanban-board {
        grid-auto-columns: clamp(21.75rem, 22vw, 24rem);
    }
}

@media (min-width: 1600px) {
    .crm-kanban-shell {
        max-width: 132rem;
    }

    .crm-kanban-board {
        grid-auto-columns: clamp(22.5rem, 20vw, 25rem);
        gap: 1.2rem;
    }
}

@media (max-width: 1279px) {
    .crm-kanban-filter-grid,
    .crm-drawer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-kanban-hero,
    .crm-kanban-filter-bar {
        grid-template-columns: minmax(0, 1fr);
    }

    .crm-kanban-hero-actions,
    .crm-kanban-filter-meta {
        justify-self: start;
        text-align: left;
    }

    .crm-kanban-filter-meta {
        max-width: 100%;
        justify-content: flex-start;
    }

    .crm-opportunity-row {
        grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.6fr);
        align-items: start;
    }

    .crm-opportunity-row-footer {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        justify-items: stretch;
    }

    .crm-drawer-header,
    .crm-entity-card,
    .crm-client-panel-header {
        flex-direction: column;
    }

    .crm-client-toolbar {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .crm-kanban-stage {
        min-height: clamp(32rem, calc(100dvh - 15rem), 42rem);
    }
}

@media (max-width: 767px) {
    .crm-kanban-filter-grid,
    .crm-drawer-grid,
    .crm-kanban-card-grid {
        grid-template-columns: 1fr;
    }

    .crm-kanban-shell {
        gap: 0.95rem;
    }

    .crm-kanban-hero,
    .crm-kanban-filters {
        padding: 1.1rem;
    }

    .crm-kanban-hero-actions {
        width: 100%;
    }

    .crm-kanban-toolbar {
        align-items: stretch;
    }

    .crm-view-switcher {
        width: 100%;
    }

    .crm-view-switcher button {
        flex: 1 1 0;
    }

    .crm-kanban-hero-actions .crm-btn {
        flex: 1 1 12rem;
    }

    .crm-opportunity-row,
    .crm-opportunity-row-metrics,
    .crm-opportunity-row-footer {
        grid-template-columns: 1fr;
    }

    .crm-opportunity-row-footer {
        justify-items: stretch;
    }

    .crm-opportunity-row-footer .crm-kanban-owner {
        justify-self: start;
    }

    .crm-list-open-btn,
    .crm-list-sale-btn {
        width: 100%;
    }

    .crm-kanban-board {
        grid-auto-columns: clamp(18rem, calc(100% - 0.8rem), 22rem);
        padding-inline-end: 0.8rem;
        scroll-padding-inline-end: 0.8rem;
    }

    .crm-drawer-panel,
    .crm-modal-panel {
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        max-width: 100%;
        border-radius: 1.5rem 1.5rem 0 0;
    }

    .crm-modal-panel {
        transform: none;
    }

    .crm-sale-summary,
    .crm-sale-totals,
    .crm-sale-item {
        grid-template-columns: 1fr;
    }

    .crm-drawer-panel {
        height: min(92dvh, 52rem);
    }

    .crm-drawer-body {
        height: calc(100% - 11.35rem);
    }

    .crm-kanban-stage {
        min-height: 31rem;
    }
}

@media (max-width: 480px) {
    .crm-kanban-page {
        --crm-stage-header-height: 5.9rem;
        --crm-stage-create-height: 3rem;
    }

    .crm-kanban-shell {
        gap: 0.85rem;
    }

    .crm-kanban-hero,
    .crm-kanban-filters {
        padding: 1rem;
        border-radius: 1.2rem;
    }

    .crm-kanban-hero-copy h1 {
        font-size: 1.35rem;
    }

    .crm-kanban-board {
        grid-auto-columns: clamp(17rem, calc(100% - 0.65rem), 20.5rem);
        gap: 0.75rem;
        padding-inline-end: 0.65rem;
        scroll-padding-inline-end: 0.65rem;
    }

    .crm-kanban-stage-header,
    .crm-kanban-card,
    .crm-kanban-stage-create,
    .crm-drawer-section,
    .crm-drawer-form,
    .crm-entity-card {
        border-radius: 1rem;
    }

    .crm-kanban-card,
    .crm-kanban-stage-header {
        padding: 0.9rem;
    }

    .crm-kanban-loading-overlay {
        padding: 1rem;
    }

    .crm-kanban-loading-panel {
        padding: 1.25rem 1rem;
    }

    .crm-drawer-tabs {
        padding-inline: 1rem;
    }

    .crm-drawer-body,
    .crm-drawer-header {
        padding-inline: 1rem;
    }
}
