/* =========================================================
   Dartdata Components CSS
   ========================================================= */

:root {
    --dd-border: #dee2e6;
    --dd-border-light: #e9ecef;
    --dd-bg-muted: #f8f9fa;
    --dd-text-muted: #6c757d;

    --dd-radius: .375rem;
    --dd-section-gap: 1rem;
}


/* =========================================================
   Página
   ========================================================= */

.dd-page {
    max-width: 1400px;
    margin: 0 auto;

    padding: .1rem;
}

.dd-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;
    margin-bottom: 1rem;
}

.dd-page-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.dd-page-subtitle {
    margin-top: .15rem;
    font-size: .82rem;
    color: var(--dd-text-muted);
}


/* =========================================================
   Toolbar
   ========================================================= */

.dd-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: .75rem;

    padding: .5rem 0;
    margin-bottom: 1rem;
}

.dd-toolbar-start,
.dd-toolbar-end {
    display: flex;
    align-items: center;
    gap: .5rem;
}


/* =========================================================
   Formulário
   ========================================================= */

.dd-form {
    font-size: .78rem;
}

.dd-form .form-label {
    font-size: .72rem;
    font-weight: 500;
    margin-bottom: .1rem;
    padding-top: .475rem;
}

.dd-form .form-control,
.dd-form .form-select {
    font-size: .78rem;
}

.dd-form-row {
    margin-bottom: .75rem;
}

/* ==========================================================
   Checkbox
   ========================================================== */

.dd-field-checkbox {
    margin-top: .25rem;
    margin-bottom: .5rem;
}

.dd-checkbox {
    display: inline-flex;
    align-items: center;
    gap: .45rem;

    margin: 0;

    font-size: .78rem;
    font-weight: 500;

    color: #495057;

    cursor: pointer;
    user-select: none;
}

.dd-checkbox .form-check-input {
    width: 1rem;
    height: 1rem;

    margin: 0;

    flex-shrink: 0;

    cursor: pointer;
}


/* =========================================================
   Section
   ========================================================= */

.dd-section {
    margin-bottom: var(--dd-section-gap);
}

.dd-section-header {
    display: flex;
    align-items: center;
    gap: .4rem;

    padding-bottom: .4rem;
    margin-bottom: .75rem;

    border-bottom: 1px solid var(--dd-border);

    font-size: .9rem;
    font-weight: 600;
}

.dd-section-body {
    padding: 0 .25rem;
}


/* =========================================================
   Card
   ========================================================= */

.dd-card {
    border: 1px solid var(--dd-border);
    border-radius: var(--dd-radius);
    background: #fff;

    margin-bottom: 1rem;
}

.dd-card-header {
    padding: .65rem .8rem;

    border-bottom: 1px solid var(--dd-border-light);

    font-size: .88rem;
    font-weight: 600;
}

.dd-card-body {
    padding: .8rem;
}


/* =========================================================
   Accordion
   ========================================================= */

.dd-accordion {
    border: 1px solid var(--dd-border);
    border-radius: var(--dd-radius);

    background: #fff;

    margin-bottom: .75rem;

    overflow: hidden;
}

.dd-accordion-header {
    display: flex;
    align-items: center;

    min-height: 42px;

    padding: .55rem .75rem;

    cursor: pointer;
    user-select: none;

    background: var(--dd-bg-muted);
}

.dd-accordion-header:hover {
    background: #f1f3f5;
}

.dd-accordion-icon {
    margin-right: .5rem;
    color: var(--dd-text-muted);
}

.dd-accordion-title {
    font-weight: 600;
    font-size: .86rem;
}

.dd-accordion-summary {
    margin-left: auto;
    margin-right: .75rem;

    color: var(--dd-text-muted);
    font-size: .78rem;
}

.dd-accordion-chevron {
    margin-left: auto;
    transition: transform .15s ease;
}

.dd-accordion[open] .dd-accordion-chevron {
    transform: rotate(90deg);
}

.dd-accordion-body {
    padding: .85rem;
}


/* remove marcador padrão do details */

.dd-accordion summary {
    list-style: none;
}

.dd-accordion summary::-webkit-details-marker {
    display: none;
}


/* =========================================================
   Empty state
   ========================================================= */

.dd-empty {
    text-align: center;

    padding: 2rem 1rem;

    color: var(--dd-text-muted);
}

.dd-empty-icon {
    display: block;

    font-size: 1.7rem;

    margin-bottom: .5rem;
}

.dd-empty-title {
    color: #495057;
    font-weight: 600;
}

.dd-empty-text {
    font-size: .82rem;
}


/* =========================================================
   Relacionamentos
   ========================================================= */

.dd-related-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));

    gap: .75rem;
}

.dd-related-card {
    display: block;

    padding: .8rem;

    border: 1px solid var(--dd-border);
    border-radius: var(--dd-radius);

    text-decoration: none;
    color: inherit;

    background: #fff;

    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

.dd-related-card:hover {
    border-color: #adb5bd;

    box-shadow:
        0 .125rem .25rem rgba(0, 0, 0, .05);
}

.dd-related-card-title {
    display: flex;
    align-items: center;

    gap: .4rem;

    font-weight: 600;
    font-size: .85rem;
}

.dd-related-card-summary {
    margin-top: .35rem;

    color: var(--dd-text-muted);

    font-size: .78rem;
}


/* =========================================================
   Página de módulo
   ========================================================= */

.dd-module-header {
    padding: .25rem 0 1rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--dd-border);
}

.dd-module-section {
    margin-bottom: 2rem;
}

.dd-module-section-title {
    margin: 0;
    font-size: .9rem;
    font-weight: 600;
}

.dd-module-section-subtitle,
.dd-module-card-meta {
    color: var(--dd-text-muted);
}

.dd-module-card {
    display: block;
    height: 100%;
    padding: 1.25rem 1.35rem;
    border: 1px solid var(--dd-border);
    border-radius: var(--dd-radius);
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease;
}

.dd-module-card:hover {
    border-color: #adb5bd;
    box-shadow: 0 .75rem 1.75rem rgba(0, 0, 0, .08);
    transform: translateY(-2px);
    color: inherit;
}

.dd-module-metric-card {
    border: 0;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--dd-border-light);
}

.dd-module-metric-card:hover {
    border: 0;
    box-shadow: inset 0 0 0 1px var(--dd-border-light);
    transform: none;
}

.dd-module-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .75rem;
}

.dd-module-card-title {
    margin-bottom: .35rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.dd-module-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: var(--dd-radius);
    background: var(--dd-bg-muted);
    color: #455d7a;
    font-size: 1.1rem;
}

.dd-module-tag {
    display: inline-block;
    padding: .25rem .5rem;
    border: 1px solid var(--dd-border-light);
    border-radius: var(--dd-radius);
    background: var(--dd-bg-muted);
    color: var(--dd-text-muted);
    font-size: .7rem;
    text-transform: uppercase;
}

.dd-module-panel {
    padding: 1.25rem;
    border: 1px solid var(--dd-border);
    border-radius: var(--dd-radius);
    background: #fff;
}

.dd-module-list {
    display: grid;
    gap: .5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dd-module-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem .9rem;
    border: 1px solid var(--dd-border-light);
    border-radius: var(--dd-radius);
    background: var(--dd-bg-muted);
    text-decoration: none;
    color: inherit;
}

.dd-module-list-item:hover {
    border-color: var(--dd-border);
    background: #f1f3f5;
    color: inherit;
}

.dd-module-empty {
    padding: 1rem;
    border: 1px dashed var(--dd-border);
    border-radius: var(--dd-radius);
    background: var(--dd-bg-muted);
    color: var(--dd-text-muted);
    text-align: center;
}

.dd-module-action-card {
    border-color: #455d7a;
}

.dd-module-section > .dd-accordion {
    margin-bottom: .85rem;
}

.dd-module-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
}

.dd-module-metric {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    min-height: 92px;
    padding: .85rem .95rem;
    border: 1px solid var(--dd-border-light);
    border-left: 4px solid #6c757d;
    border-radius: var(--dd-radius);
    background: #fff;
}

.dd-module-metric--success {
    border-left-color: #198754;
}

.dd-module-metric--danger {
    border-left-color: #dc3545;
}


/* =========================================================
   Tree
   ========================================================= */

.dd-tree {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.dd-tree-node {
    border: 1px solid var(--dd-border-light);
    border-radius: .75rem;
    background: #fff;
    overflow: hidden;
}

.dd-tree-node + .dd-tree-node {
    margin-top: .1rem;
}

.dd-tree-node-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem .9rem;
    min-height: 64px;
}

.dd-tree-node-main {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    flex: 1;
}

.dd-tree-toggle {
    width: 1.8rem;
    height: 1.8rem;
    border: 1px solid #dfe7f1;
    background: var(--dd-bg-muted);
    color: #475569;
    border-radius: .5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.dd-tree-branch {
    width: 1.2rem;
    color: var(--dd-text-muted);
    text-align: center;
    flex-shrink: 0;
}

.dd-tree-label {
    font-weight: 600;
    color: #1f2937;
}

.dd-tree-subtree {
    margin-left: 1.25rem;
    padding: .5rem 0 .75rem 1rem;
    border-left: 2px solid #eef2f7;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.dd-tree-node small {
    color: var(--dd-text-muted);
}

.dd-tree-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: .2rem .65rem;
    font-size: .72rem;
    font-weight: 600;
}

.dd-tree-chip.inactive {
    background: #f1f3f5;
    color: #5b636a;
}

.dd-tree-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
}

.dd-tree-actions .btn {
    padding: .35rem .55rem;
}


/* =========================================================
   Modal de formulário
   ========================================================= */

.dd-modal {
    border: 1px solid #dfe7f1;
    border-radius: 1rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .08);
    overflow: hidden;
}

.dd-modal-header {
    background: linear-gradient(135deg, #0f172a 0%, #1f2937 100%);
    color: #fff;
    padding: 1rem 1.25rem;
    border-bottom: 0;
}

.dd-modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.dd-eyebrow {
    font-size: .7rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .75;
    margin-bottom: .2rem;
}

.dd-modal-body {
    padding: 1rem 1.25rem .5rem;
    background: #f8fafc;
}

.dd-modal-summary {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem .9rem;
    border: 1px solid #dde7f2;
    border-radius: .8rem;
    background: #fff;
    color: #3d4a5d;
    font-size: .9rem;
    margin-bottom: 1rem;
}

.dd-modal-summary i {
    color: #2563eb;
    font-size: 1.2rem;
}

.dd-modal-summary--danger i {
    color: #dc3545;
}

.dd-delete-context {
    display: flex;
    align-items: baseline;
    gap: .4rem;
    padding: .8rem .9rem;
    border: 1px solid #f1c7cc;
    border-radius: .8rem;
    background: #fff5f5;
}

.dd-delete-context strong {
    color: #842029;
}

.dd-delete-context span {
    color: #495057;
}

.dd-modal-context {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .8rem;
    margin-bottom: .25rem;
}

.dd-context-item {
    border: 1px solid #dfe7f1;
    border-radius: .8rem;
    background: #fff;
    padding: .75rem .9rem;
    min-height: 74px;
}

.dd-context-label {
    display: block;
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: .4rem;
}

.dd-context-item strong {
    color: #111827;
    font-size: .96rem;
}

.dd-context-item--type {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.dd-modal-grid .form-label {
    font-size: .75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: .45rem;
}

.dd-modal-grid .form-control,
.dd-modal-grid .form-select {
    border-radius: .75rem;
    border-color: #dbe2ed;
    background: #fff;
    min-height: 44px;
}

.dd-modal-footer {
    background: #fff;
    border-top: 1px solid #edf2f7;
    padding: .9rem 1.25rem 1rem;
    justify-content: space-between;
    align-items: center;
}

.dd-compact-switch {
    margin: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.dd-module-metric--primary {
    border-left-color: #0d6efd;
}

.dd-module-metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    border-radius: var(--dd-radius);
    background: var(--dd-bg-muted);
    color: #495057;
    font-size: .95rem;
}

.dd-module-metric-content {
    min-width: 0;
}

.dd-module-metric-label {
    color: var(--dd-text-muted);
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.dd-module-metric-value {
    margin-top: .15rem;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

.dd-module-metric-meta {
    margin-top: .15rem;
    color: var(--dd-text-muted);
    font-size: .78rem;
}

.dd-module-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: .65rem;
}

.dd-module-menu-grid--compact {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.dd-module-menu-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 72px;
    padding: .75rem .85rem;
    border: 1px solid var(--dd-border-light);
    border-radius: var(--dd-radius);
    background: #fff;
    color: inherit;
    text-decoration: none;
    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        transform .15s ease;
}

.dd-module-menu-card:hover {
    border-color: #adb5bd;
    box-shadow: 0 .35rem .9rem rgba(0, 0, 0, .06);
    transform: translateY(-1px);
    color: inherit;
}

.dd-module-menu-card--compact {
    justify-content: space-between;
    min-height: 52px;
    padding: .65rem .75rem;
    background: var(--dd-bg-muted);
}

.dd-module-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.15rem;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: var(--dd-radius);
    background: var(--dd-bg-muted);
    color: #455d7a;
    font-size: 1rem;
}

.dd-module-menu-content {
    display: grid;
    min-width: 0;
    gap: .15rem;
}

.dd-module-menu-title {
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.dd-module-menu-meta {
    overflow: hidden;
    color: var(--dd-text-muted);
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dd-module-menu-arrow {
    margin-left: auto;
    color: var(--dd-text-muted);
    font-size: .9rem;
}

.dd-module-accordion {
    margin-bottom: .75rem;
}

.dd-module-accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1rem;
    border: 1px solid var(--dd-border);
    border-radius: var(--dd-radius);
    background: #fff;
    cursor: pointer;
    list-style: none;
}

.dd-module-accordion summary::-webkit-details-marker {
    display: none;
}

.dd-module-accordion[open] summary {
    border-radius: var(--dd-radius) var(--dd-radius) 0 0;
    background: var(--dd-bg-muted);
}

.dd-module-accordion-body {
    padding: .85rem;
    border: 1px solid var(--dd-border);
    border-top: 0;
}


/* =========================================================
   Utilitários de tabelas e telas
   ========================================================= */

.dd-table-actions {
    width: 1%;
    white-space: nowrap;
}

.dd-nowrap {
    white-space: nowrap;
}

.dd-select-auto {
    width: auto;
}

.dd-table-col-72 { width: 72px; }
.dd-table-col-100 { width: 100px; }
.dd-table-col-110 { min-width: 110px; }
.dd-table-col-120 { width: 120px; }
.dd-table-col-140 { width: 140px; }
.dd-table-col-150 { width: 150px; }
.dd-table-col-160 { width: 160px; }
.dd-table-col-180 { width: 180px; }
.dd-table-col-220 { width: 220px; }
.dd-table-col-p5 { width: 5%; }
.dd-table-col-p10 { width: 10%; }
.dd-table-col-p15 { width: 15%; }
.dd-table-col-p20 { width: 20%; }
.dd-table-col-p25 { width: 25%; }
.dd-table-col-p30 { width: 30%; }
.dd-table-col-p35 { width: 35%; }
.dd-table-indent { padding-left: attr(data-indent px); }

.dd-icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
}

.dd-selection-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 60vh;
    margin-top: 80px;
}

.dd-selection-card {
    width: 100%;
    max-width: 480px;
}

.dd-contract-card {
    width: 100%;
    max-width: 600px;
}

.dd-topbar {
    height: 52px;
}

.dd-auth-loader {
    position: fixed;
    z-index: 90000;
    width: 100%;
    height: 100vh;
    background: #464545;
    opacity: 1;
    visibility: visible;
    transition: all .3s ease-in-out;
}

.dd-auth-loader.fadeOut {
    opacity: 0;
    visibility: hidden;
}

.dd-auth-spinner {
    position: absolute;
    top: calc(50% - 20px);
    left: calc(50% - 20px);
    width: 40px;
    height: 40px;
    border-radius: 100%;
    background-color: #333;
    animation: dd-auth-scaleout 1s infinite ease-in-out;
}

@keyframes dd-auth-scaleout {
    0% { transform: scale(0); }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}


.crm-kanban {
    display: flex;
    gap: .75rem;
    overflow-x: auto;

    padding-bottom: 8rem;

    min-height: calc(100vh - 180px);
    align-items: flex-start;
}

.crm-kanban-column {
    flex: 1 0 240px;
    min-width: 240px;
    max-width: 280px;

    background: #f8f9fa;
    border: 1px solid var(--bs-border-color);
    border-radius: .4rem;
}

.crm-kanban-column-header {
    padding: .6rem .65rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.crm-kanban-column-title {
    font-size: .85rem;
    font-weight: 600;
}

.crm-kanban-column-total {
    font-size: .72rem;
    color: var(--bs-secondary-color);
    margin-top: .15rem;
}

.crm-kanban-column-body {
    padding: .5rem;
    min-height: 120px;
}

.crm-kanban-card {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .35rem;
    cursor: grab;
    transition:
        box-shadow .15s ease,
        transform .15s ease,
        opacity .15s ease;
}

.crm-kanban-card:active {
    cursor: grabbing;
}

.crm-kanban-card.is-dragging {
    opacity: .5;
}

.crm-kanban-column-body.is-drag-over {
    background: var(--bs-secondary-bg);
    outline: 2px dashed var(--bs-border-color);
    outline-offset: -2px;
}

.crm-kanban-card:hover {
    box-shadow: 0 .2rem .5rem rgba(0, 0, 0, .08);
    transform: translateY(-1px);
}

.crm-kanban-card .card-body {
    padding: .6rem;
}

.crm-kanban-card-title {
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.2;
}

.crm-kanban-card-partner {
    font-size: .72rem;
    line-height: 1.2;
    color: var(--bs-secondary-color);
}

.crm-kanban-card-value {
    font-size: .78rem;
    font-weight: 600;
}

.crm-kanban-card-meta {
    font-size: .68rem;
    color: var(--bs-secondary-color);
}

.crm-kanban-empty {
    padding: 1.5rem .5rem;
    text-align: center;
    font-size: .72rem;
    color: var(--bs-secondary-color);
}
