/* Plan de ruta.
   La clase plan-* va en el envoltorio de Filament. La rejilla real es el hijo .fi-sc.
   Aplicarla al envoltorio deja el contenido en la primera columna y el resto vacío. */

.plan-form.fi-sc {
    gap: 0.6rem !important;
}

.fi-grid-col[wire\:key$="leaflet_assets"] {
    display: none !important;
}

.plan-band > .fi-section > .fi-section-header {
    padding: 0.55rem 0.85rem !important;
    gap: 0.5rem !important;
}

.plan-band > .fi-section .fi-section-header-heading {
    font-size: 0.92rem;
    line-height: 1.3;
}

.plan-band > .fi-section.fi-compact:not(.fi-divided) > .fi-section-content-ctn > .fi-section-content {
    padding: 0.7rem 0.9rem !important;
}

.plan-fields,
.plan-workspace,
.plan-orders {
    display: block;
    width: 100%;
    min-width: 0;
}

.plan-fields,
.plan-workspace {
    container-type: inline-size;
}

.plan-fields > .fi-sc {
    align-items: end;
}

.plan-workspace > .fi-sc {
    align-items: start;
    grid-template-columns: minmax(0, 1fr) !important;
}

.plan-fields > .fi-sc > .fi-grid-col,
.plan-workspace > .fi-sc > .fi-grid-col {
    min-width: 0;
    grid-column: auto !important;
}

@container (min-width: 680px) {
    .plan-fields > .fi-sc {
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr) minmax(0, 1.15fr) minmax(0, 0.8fr) !important;
    }
}

@container (min-width: 1040px) {
    .plan-fields > .fi-sc {
        grid-template-columns: minmax(0, 1.7fr) minmax(8.25rem, 0.72fr) minmax(0, 1.25fr) minmax(7.25rem, 0.68fr) minmax(9rem, 0.85fr) minmax(5.5rem, 0.5fr) !important;
    }
}

.plan-metrics {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 1.15rem;
}

.plan-metric {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    border: 0;
    background: transparent;
    padding: 0;
}

.plan-metric__label {
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    color: #64748b;
}

.plan-metric__value {
    font-size: 0.98rem;
    font-weight: 650;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.plan-metric--warn .plan-metric__value {
    color: #dc2626;
}

.plan-alternatives {
    margin-top: 0.45rem;
    max-height: 8.75rem;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #fff;
}

.plan-alternatives table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.plan-alternatives th,
.plan-alternatives td {
    padding: 0.38rem 0.65rem;
    text-align: left;
    white-space: nowrap;
}

.plan-alternatives th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #334155;
    font-weight: 650;
    border-bottom: 1px solid #e5e7eb;
}

.plan-alternatives td {
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.plan-alternatives tr.is-applied {
    background: #eff6ff;
}

.plan-alternatives .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.plan-alternatives .center {
    text-align: center;
}

.plan-count {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

.plan-workspace {
    --plan-stage: max(22rem, calc(100dvh - 27rem));
}

.plan-map .selection-map-container {
    height: 22rem;
    width: 100%;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    z-index: 1;
    background: #e2e8f0;
}

.plan-map__hint {
    margin: 0.3rem 0 0;
    font-size: 0.72rem;
    line-height: 1.3;
    color: #64748b;
    text-align: right;
}

.plan-orders {
    max-height: 22rem;
    overflow: auto;
}

.plan-orders > .fi-sc {
    gap: 0 !important;
}

.plan-orders .fi-sc-tabs .fi-sc-tabs-tab.fi-active {
    margin-top: 0.35rem !important;
}

.plan-orders .fi-tabs {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
}

.plan-orders .fi-tabs-item.plan-product-tab {
    box-shadow: inset 0 -2px 0 var(--plan-product, #94a3b8);
}

.plan-orders .plan-order-actions {
    margin: 0 0 0.35rem;
}

.plan-orders .plan-order-actions .fi-ac {
    gap: 0.35rem;
    flex-direction: row;
    justify-content: flex-end;
}

.plan-orders .plan-order-action.fi-btn {
    min-height: 0;
    padding: 0.22rem 0.55rem;
    font-size: 0.75rem;
    line-height: 1.2;
    font-weight: 600;
    border-radius: 4px;
    background: #fff;
    color: #0f172a;
    box-shadow: inset 0 0 0 1px #d0d5dd;
}

.plan-orders .plan-order-action.fi-btn:hover {
    background: #f3f5f8;
}

.dark .plan-orders .plan-order-action.fi-btn {
    background: transparent;
    color: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.plan-orders .fi-fo-checkbox-list-options {
    gap: 0.28rem !important;
}

.plan-orders .fi-fo-checkbox-list-option {
    gap: 0.4rem !important;
    align-items: flex-start;
}

.plan-orders .fi-fo-checkbox-list-option-text {
    line-height: 1.25 !important;
}

.plan-orders .fi-checkbox-input {
    margin-top: 0.12rem;
}

.plan-order-customer {
    color: #64748b;
    font-weight: 450;
}

.plan-missing {
    margin-top: 0.45rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    background: #fffbeb;
    color: #78350f;
    font-size: 0.8rem;
    line-height: 1.45;
}

.plan-missing a {
    color: #9a3412;
    font-weight: 650;
    text-decoration: underline;
}

.plan-missing__label {
    font-weight: 700;
    margin-right: 0.35rem;
}

@container (min-width: 860px) {
    .plan-workspace > .fi-sc {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) !important;
        align-items: stretch;
    }

    .plan-map .selection-map-container {
        height: var(--plan-stage);
        min-height: 22rem;
    }

    .plan-workspace > .fi-sc > .fi-grid-col:nth-child(2) {
        min-height: 0;
        max-height: var(--plan-stage);
        overflow: auto;
        contain: strict;
        border: 1px solid #e5e7eb;
        border-radius: 4px;
        background: #f8fafc;
        padding: 0.5rem 0.6rem;
    }

    .plan-orders {
        max-height: none;
        overflow: visible;
    }
}

.dark .plan-metric__label,
.dark .plan-count,
.dark .plan-map__hint,
.dark .plan-order-customer {
    color: #94a3b8;
}

.dark .plan-orders .fi-tabs {
    background: #111827;
}

.dark .plan-metric__value {
    color: #f8fafc;
}

.dark .plan-alternatives {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.4);
}

.dark .plan-alternatives th {
    background: #1e293b;
    color: #e2e8f0;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dark .plan-alternatives td {
    color: #cbd5e1;
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.dark .plan-alternatives tr.is-applied {
    background: rgba(59, 130, 246, 0.15);
}

/* Estado y composición del espacio de planificación. */
.plan-empty {
    min-height: 12rem;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 0.35rem;
    padding: 2rem;
    text-align: center;
    color: var(--admin-text-muted, #667085);
    background: var(--admin-surface-soft, #f8fafc);
    border: 1px dashed var(--admin-border, #d8e0e8);
    border-radius: var(--admin-radius, 8px);
}

.plan-empty strong {
    color: var(--admin-text, #1d2939);
    font-size: 0.95rem;
}

.plan-empty span {
    max-width: 32rem;
    font-size: 0.82rem;
    line-height: 1.45;
}

.fi-panel-admin .plan-band--stage .fi-section-header-after-ctn .fi-btn.fi-color-primary:not(.fi-outlined) {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: var(--admin-text-muted, #667085) !important;
}

.plan-count {
    display: inline-flex;
    padding: 0.25rem 0.55rem;
    color: var(--admin-text-muted, #667085);
    background: var(--admin-surface-soft, #f8fafc);
    border: 1px solid var(--admin-border, #d8e0e8);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
    gap: 0.2rem;
}

.plan-orders .fi-tabs-item.plan-product-tab {
    box-shadow: none;
}

.plan-orders .fi-tabs-item.plan-product-tab.fi-active {
    background: rgba(15, 107, 127, 0.08);
    box-shadow: inset 0 0 0 1px rgba(15, 107, 127, 0.18);
}

@media (max-width: 640px) {
    .plan-band--stage > .fi-section > .fi-section-header {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .plan-band--stage .fi-section-header-text-ctn {
        flex: 1 1 calc(100% - 2rem);
        min-width: 0;
    }

    .plan-band--stage .fi-section-header-after-ctn {
        flex: 1 0 100%;
        margin-inline-start: 2rem;
    }
}

.dark .plan-map .selection-map-container {
    border-color: rgba(255, 255, 255, 0.12);
}

@container (min-width: 860px) {
    .dark .plan-workspace > .fi-sc > .fi-grid-col:nth-child(2) {
        border-color: rgba(255, 255, 255, 0.12);
        background: rgba(255, 255, 255, 0.03);
    }
}

.dark .plan-missing {
    background: rgba(120, 53, 15, 0.35);
    border-color: rgba(251, 191, 36, 0.4);
    color: #fde68a;
}

.dark .plan-missing a {
    color: #fcd34d;
}
