/* UnidadesResponsable — estilos del módulo */
/* Control de unidades — portal card chrome (UI only) */

.unidades-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}
.unidades-kpi-grid + .unidades-panel {
    margin-bottom: 10px;
    padding: 10px;
}
.unidades-kpi-grid + .unidades-panel .card-header {
    margin-bottom: 10px;
}
.unidades-kpi-grid + .unidades-panel + .unidades-two {
    margin-top: 0;
}
@media (max-width: 1100px) {
    .unidades-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .unidades-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.unidades-kpi-card {
    min-width: 0;
    animation: unidades-kpi-in .45s ease both;
}
.unidades-kpi-card:nth-child(1) { animation-delay: .02s; }
.unidades-kpi-card:nth-child(2) { animation-delay: .06s; }
.unidades-kpi-card:nth-child(3) { animation-delay: .10s; }
.unidades-kpi-card:nth-child(4) { animation-delay: .14s; }
.unidades-kpi-card:nth-child(5) { animation-delay: .18s; }

.unidades-kpi-card .stat-value {
    color: var(--text);
}
.unidades-kpi-card.is-danger .stat-value { color: var(--danger, #c74747); }
.unidades-kpi-card.is-warn .stat-value { color: var(--warning, #a86a0c); }

.unidades-stat-icon.is-primary {
    background: var(--primary-soft, color-mix(in srgb, var(--primary) 16%, transparent));
    color: var(--primary);
}
.unidades-stat-icon.is-info {
    background: color-mix(in srgb, #2563eb 14%, transparent);
    color: #2563eb;
}

.unidades-stat-icon svg {
    width: 17px;
    height: 17px;
}

@keyframes unidades-kpi-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes unidades-icon-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger, #c74747) 28%, transparent); }
    50% { transform: scale(1.04); box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger, #c74747) 1%, transparent); }
}

@keyframes unidades-icon-soft {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.unidades-stat-icon--pulse {
    animation: unidades-icon-pulse 2.2s ease-in-out infinite;
}
.unidades-stat-icon--soft {
    animation: unidades-icon-soft 2.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .unidades-kpi-card,
    .unidades-stat-icon--pulse,
    .unidades-stat-icon--soft {
        animation: none;
    }
}

.unidades-panel {
    margin-bottom: 10px;
}
.unidades-panel .card-header {
    margin-bottom: 10px;
}
.unidades-panel .page-description {
    margin-top: 0;
    margin-bottom: 12px;
}

.unidades-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
.unidades-two > .unidades-panel {
    margin-bottom: 0;
    padding: 10px;
}
.unidades-two > .unidades-panel .card-header {
    margin-bottom: 10px;
}

.unidades-two + .table-card {
    margin-top: 0;
    padding: 10px;
}
.unidades-two + .table-card .card-header {
    margin-bottom: 10px;
}
@media (max-width: 900px) {
    .unidades-two { grid-template-columns: 1fr; }
}


.unidades-hz-chart {
    width: 100%;
    height: min(280px, 48vw);
    min-height: 220px;
}

.unidades-hz {
    position: relative;
    height: 150px;
    margin: 6px 4px 8px;
    border-bottom: 1px solid var(--border);
}
.unidades-hz .tick {
    position: absolute;
    bottom: -20px;
    font-size: 11px;
    color: var(--text-muted);
    transform: translateX(-50%);
}
.unidades-hz .hoy {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: var(--primary);
}
.unidades-hz .hoy i {
    position: absolute;
    top: -2px;
    left: 6px;
    font-style: normal;
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
}
.unidades-hz .zona {
    position: absolute;
    top: 0; bottom: 0;
    background: color-mix(in srgb, var(--danger, #c74747) 14%, transparent);
}
.unidades-dot {
    position: absolute;
    width: 13px; height: 13px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    transform: translate(-50%, 0);
    cursor: pointer;
    padding: 0;
}
.unidades-dot.red { background: var(--danger, #c74747); }
.unidades-dot.amb { background: #a86a0c; }
.unidades-dot.grn { background: var(--primary); }
.unidades-legend {
    display: flex;
    gap: 16px;
    margin-top: 28px;
    color: var(--text-muted);
    font-size: 12.5px;
    flex-wrap: wrap;
}
.unidades-legend i {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
    margin-right: 5px;
}

.unidades-bar {
    display: grid;
    grid-template-columns: 110px 1fr 40px;
    gap: 10px;
    align-items: center;
    margin: 7px 0;
    font-size: 13px;
}
.unidades-bar div {
    height: 10px;
    background: color-mix(in srgb, var(--border) 70%, transparent);
    border-radius: 5px;
    overflow: hidden;
}
.unidades-bar div i {
    display: block;
    height: 100%;
    background: var(--primary);
}

.unidades-estado-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.unidades-estado-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: #fdfdfd;
}
.unidades-estado-row strong {
    font-variant-numeric: tabular-nums;
}

.unidades-estado-chart {
    position: relative;
    width: 100%;
    height: min(300px, 52vw);
    min-height: 240px;
}
.unidades-estado-mosaic {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    width: 100%;
    height: 100%;
    min-height: 0;
}
.unidades-estado-tile {
    position: relative;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: calc(var(--radius, 14px) - 2px);
    background: var(--tile, #1f7a4d);
    cursor: pointer;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
    text-align: left;
}
.unidades-estado-tile.is-operativo { grid-column: 1; grid-row: 1 / span 2; }
.unidades-estado-tile.is-inoperativo { grid-column: 2; grid-row: 1; }
.unidades-estado-tile.is-sin { grid-column: 3; grid-row: 1; }
.unidades-estado-tile.is-taller { grid-column: 2; grid-row: 2; }
.unidades-estado-tile.is-baja { grid-column: 3; grid-row: 2; }
.unidades-estado-tile-label {
    position: absolute;
    left: 14px;
    top: 12px;
    right: 12px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.28);
    pointer-events: none;
}
.unidades-estado-tile-label strong {
    display: block;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
}
.unidades-estado-tile-label em {
    display: block;
    margin-top: 4px;
    font-size: 14px;
    font-style: normal;
    font-weight: 700;
    opacity: .95;
}
.unidades-estado-tip {
    position: fixed;
    z-index: 9999;
    padding: 8px 11px;
    border-radius: 0.5rem;
    background: var(--surface, #fff);
    color: var(--text, #17201b);
    border: 1px solid var(--border, rgba(0,0,0,.12));
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    pointer-events: none;
    white-space: nowrap;
}


.unidades-filt-nav {
    display: block;
    margin: 10px 0 12px;
    padding: 12px 10px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-sizing: border-box;
}
.unidades-filt-nav > legend {
    width: auto;
    margin: 0 0 0 10px;
    padding: 0 8px;
    float: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.unidades-filt-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 10px;
    min-width: 0;
    width: 100%;
}
.unidades-filt-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 0;
    min-width: 0;
    flex: 0 1 150px;
}
.unidades-filt-k {
    margin: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}
.unidades-filt-search {
    flex: 1 1 220px;
    min-width: 180px;
}
.unidades-filt-search .list-search-wrap,
.unidades-filt-search .field-search {
    width: 100%;
}
.unidades-filt-search .list-search,
.unidades-filt-search .field-control {
    width: 100%;
    height: 42px;
    border-radius: 11px;
}
.unidades-filt-field .field-select,
.unidades-filt-field .select-picker {
    width: 100%;
    min-width: 0;
}
.unidades-filt-field .select-picker-trigger {
    width: 100%;
    height: 42px;
    border-radius: 11px;
}
@media (max-width: 1100px) {
    .unidades-filt-row {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    .unidades-filt-field {
        flex: 0 0 140px;
    }
    .unidades-filt-search {
        flex: 0 0 200px;
    }
}

.unidades-propietario-chart {
    width: 100%;
    height: min(300px, 52vw);
    min-height: 240px;
}


.unidades-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.unidades-badge.ok { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
.unidades-badge.warn { background: #fbefd6; color: #a86a0c; }
.unidades-badge.danger { background: color-mix(in srgb, var(--danger, #c74747) 16%, transparent); color: var(--danger, #c74747); }
.unidades-badge.mute { background: color-mix(in srgb, var(--border) 80%, transparent); color: var(--text-muted); }

.unidades-drawer-scrim {
    display: none !important;
}
.unidades-drawer {
    position: fixed;
    top: var(--topbar-height, 70px);
    right: 0;
    left: auto;
    bottom: 0;
    width: min(400px, 100vw);
    height: auto;
    display: block;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 16px 0 0 0;
    box-shadow: -16px 0 40px rgba(16, 22, 20, 0.16);
    z-index: 1200;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 18px 28px;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform 0.28s ease;
}
.unidades-drawer.is-open {
    transform: translateX(0);
}
.unidades-drawer[hidden] {
    display: none !important;
}
body.unidades-ficha-dock-open .content {
    padding-right: calc(var(--content-pad, 10px) + min(400px, 36vw));
}
.unidades-drawer-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}
.unidades-drawer-kicker {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.unidades-drawer-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
}
.unidades-drawer-vehicle {
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
    line-height: 1.35;
}
.unidades-drawer-vehicle span {
    font-weight: 500;
    color: var(--text-muted);
}
.unidades-drawer-sub {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}
.unidades-drawer-badge {
    margin-top: 12px;
}
.unidades-drawer-section {
    margin: 10px 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.9;
}
.unidades-drawer-help {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
}
.unidades-kv {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    margin: 14px 0 4px;
}
.unidades-kv span {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.unidades-kv b {
    display: block;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.01em;
    color: var(--text);
}
.unidades-doc-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 10px;
}
.unidades-doc-row {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius, 14px) - 2px);
    background: #fdfdfd;
}
.unidades-doc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.unidades-doc-head strong {
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0.02em;
}
.unidades-doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.unidades-doc-bar {
    margin-top: 8px;
    height: 3px;
    min-height: 3px;
    max-height: 3px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--border) 80%, transparent);
    overflow: hidden;
    position: relative;
}
.unidades-doc-bar .unidades-doc-fill,
.unidades-doc-bar i {
    display: block;
    height: 3px !important;
    min-height: 3px;
    max-height: 3px;
    width: 72%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: var(--primary);
    font-size: 0;
    line-height: 0;
    box-shadow: none;
}
.unidades-doc-bar[data-status="ok"] .unidades-doc-fill,
.unidades-doc-bar[data-status="ok"] i {
    width: 72%;
    background: var(--primary);
}
.unidades-doc-bar[data-status="warn"] .unidades-doc-fill,
.unidades-doc-bar[data-status="warn"] i {
    width: 38%;
    background: #c58a13;
}
.unidades-doc-bar[data-status="danger"] .unidades-doc-fill,
.unidades-doc-bar[data-status="danger"] i {
    width: 100%;
    background: var(--danger, #c74747);
}
.unidades-doc-bar[data-status="mute"] .unidades-doc-fill,
.unidades-doc-bar[data-status="mute"] i {
    width: 12%;
    background: #6b7280;
}
.unidades-timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 4px;
}
.unidades-timeline li {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 0 0 14px 8px;
    border-left: 2px solid color-mix(in srgb, var(--primary) 35%, var(--border));
}
.unidades-timeline li:last-child {
    padding-bottom: 0;
}
.unidades-timeline i {
    position: absolute;
    left: -5px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.unidades-timeline strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
}
.unidades-timeline span {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}
.unidades-note {
    margin-top: 14px;
    padding: 12px;
    border-radius: calc(var(--radius) - 2px);
    border: 1px dashed var(--border);
    background: #f2f7f4;
}
.unidades-note strong {
    display: block;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.unidades-note p {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.4;
}

.unidades-drawer-close {
    color: #fff;
    border-color: var(--danger, #c74747);
    background: var(--danger, #c74747);
    box-shadow: none;
}
.unidades-drawer-close:hover,
.unidades-drawer-close:focus-visible {
    color: #fff;
    border-color: #af3e3e;
    background: #af3e3e;
}
.unidades-drawer-close:active {
    background: #9b3737;
}

.unidades-drawer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}
.unidades-drawer-actions .ghost-button,
.unidades-drawer-actions .primary-button {
    flex: 1 1 160px;
}
.data-table th:last-child {
    white-space: nowrap;
    font-size: 11px;
    letter-spacing: 0.05em;
}

/* OCR upload */
.unidades-ocr {
    position: relative;
    flex: 0 0 auto;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #cec2e8;
    border-radius: var(--radius, 14px);
    background: #f7f3fe;
    overflow: visible;
    box-sizing: border-box;
    min-height: 0;
}
.unidades-ocr-title {
    margin: 0 0 8px;
    padding: 0;
    border: none;
    background: none;
    display: block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.35;
    color: var(--text);
    text-transform: none;
}
.unidades-ocr .unidades-drawer-help {
    display: block;
    margin: 0 0 12px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-muted);
}
.unidades-ocr-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
    flex: 0 0 auto;
    min-height: 148px;
    padding: 18px 14px;
    border: 2px dashed #ab89ea;
    border-radius: 12px;
    background: #f5effe;
    color: var(--text);
    cursor: pointer;
    text-align: center;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    transition: background .15s ease, border-color .15s ease;
}
.unidades-ocr-drop:hover,
.unidades-ocr-drop.is-drag {
    background: #ede3fc;
    border-color: #7c3aed;
}
.unidades-ocr-drop.is-busy {
    pointer-events: none;
}
.unidades-ocr-drop > svg {
    width: 28px;
    height: 28px;
    stroke: #7c3aed;
    fill: none;
    stroke-width: 1.7;
    flex-shrink: 0;
}
.unidades-ocr-drop > strong {
    display: block;
    font-size: 13.5px;
    font-weight: 650;
    color: #5b21b6;
}
html[data-theme="dark"] .unidades-ocr-drop > strong,
html.dark .unidades-ocr-drop > strong {
    color: #c4b5fd;
}
.unidades-ocr-drop > span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}
.unidades-ocr-drop > input[type="file"] {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
    border: 0;
}
.unidades-ocr-file {
    display: block;
    margin-top: 10px;
    min-height: 0;
    font-size: 12.5px;
    color: var(--text-muted);
    word-break: break-all;
}

/* Progreso 0–100% solo dentro de la zona punteada */
.unidades-ocr-progress {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    padding: 10px;
    border-radius: inherit;
    background: #f5effe;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.unidades-ocr-progress[hidden] {
    display: none !important;
}
.unidades-ocr-progress-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.unidades-ocr-ring {
    position: relative;
    width: 72px;
    height: 72px;
}
.unidades-ocr-ring > svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.unidades-ocr-track,
.unidades-ocr-bar {
    fill: none;
    stroke-width: 8;
}
.unidades-ocr-track {
    stroke: #d2cae7;
}
.unidades-ocr-bar {
    stroke: #7c3aed;
    stroke-linecap: round;
    transition: none;
}
.unidades-ocr-core,
.unidades-ocr-check {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    place-content: center;
}
.unidades-ocr-core {
    align-items: baseline;
    grid-auto-flow: column;
    gap: 0;
}
.unidades-ocr-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.unidades-ocr-suffix {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}
.unidades-ocr-check[hidden],
.unidades-ocr-core[hidden] {
    display: none !important;
}
.unidades-ocr-check svg {
    width: 28px;
    height: 28px;
    color: #7c3aed;
}
.unidades-ocr-label {
    margin: 0;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

/* Page tabs + Alta/Edición form */
.unidades-page-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
}
.unidades-page-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 14px);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.unidades-page-tab:hover {
    color: var(--text);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}
.unidades-page-tab.is-active {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    background: #e9f2ed;
}
.unidades-form-card {
    margin-bottom: 10px;
    padding: 10px;
}
.unidades-form-card .form-section {
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.unidades-form-card .form-grid,
.unidades-form-card .form-grid-4 {
    gap: 10px;
}
.unidades-form-card .field-label .req {
    color: var(--danger, #c74747);
    font-style: normal;
    font-weight: 700;
    margin-left: 2px;
}
.unidades-form-card textarea.field-control {
    min-height: 84px;
    resize: vertical;
}
.unidades-form-actions {
    margin-top: 10px;
    gap: 10px;
}

.unidades-ctrl-historial {
    margin-top: 10px;
}
.unidades-form-card .page-description {
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

/* Unidades y placas — layout 2 columnas */
.unidades-ident-split {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
    gap: 14px;
    align-items: stretch;
}
.unidades-ident-fields {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.unidades-ident-fields .form-section:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
}
.unidades-ident-fields .unidades-form-actions {
    margin-top: auto;
}
.unidades-ident-upload {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: 100%;
}
.unidades-soat-drop-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
}
.unidades-soat-drop-stage .unidades-soat-drop {
    flex: 1 1 auto;
    min-height: 100%;
    height: 100%;
    border-color: #78ac92;
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}
.unidades-soat-drop-stage .unidades-soat-drop:hover,
.unidades-soat-drop-stage .unidades-soat-drop.is-drag {
    background: #e0ece6;
    border-color: var(--primary);
}
.unidades-soat-drop-stage .unidades-soat-drop > svg {
    stroke: var(--primary);
}
.unidades-soat-drop-stage .unidades-soat-drop > strong {
    color: #1c6f47;
}
html[data-theme="dark"] .unidades-soat-drop-stage .unidades-soat-drop > strong,
html.dark .unidades-soat-drop-stage .unidades-soat-drop > strong {
    color: #62a282;
}
.unidades-soat-drop-stage .unidades-soat-drop[hidden] {
    display: none !important;
}
.unidades-soat-drop-stage .unidades-ocr-progress {
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: inherit;
    background: #e9f2ed;
}
.unidades-soat-drop-stage .unidades-ocr-ring {
    width: 128px;
    height: 128px;
}
.unidades-soat-drop-stage .unidades-ocr-value {
    font-size: 30px;
}
.unidades-soat-drop-stage .unidades-ocr-suffix {
    font-size: 13px;
}
.unidades-soat-drop-stage .unidades-ocr-track {
    stroke: #bdd3c7;
}
.unidades-soat-drop-stage .unidades-ocr-bar {
    stroke: var(--primary);
}
.unidades-soat-drop-stage .unidades-ocr-check svg {
    width: 36px;
    height: 36px;
    color: var(--primary);
}
.unidades-soat-preview {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    background: #eff6f3;
    border: 2px dashed #86b49d;
    border-radius: 12px;
    box-sizing: border-box;
}
.unidades-soat-preview[hidden] {
    display: none !important;
}
.unidades-soat-preview img,
.unidades-soat-preview-frame {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border: 0;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 4px 16px rgba(16, 22, 20, 0.1);
}
.unidades-soat-preview img {
    object-fit: contain;
}
.unidades-soat-preview-frame {
    display: block;
}
.unidades-soat-preview img[hidden],
.unidades-soat-preview-frame[hidden],
.unidades-soat-preview-pdf[hidden] {
    display: none !important;
}
.unidades-soat-preview-pdf {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 160px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    text-align: center;
}
.unidades-soat-preview-pdf strong {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--primary);
}
.unidades-soat-preview-pdf span {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
}
.unidades-soat-preview-clear {
    flex: 0 0 auto;
    align-self: center;
}
.unidades-form-card .field-span-all {
    grid-column: 1 / -1;
}
.unidades-form-mode {
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 14px);
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 600;
}
.unidades-form-mode[hidden] {
    display: none !important;
}
.unidades-placas-board {
    margin: 10px 0;
    padding: 10px;
}
.unidades-placas-board .card-header {
    margin-bottom: 10px;
}
.unidades-placas-board .oc-items-wrap {
    margin-top: 0;
}
.unidades-placas-board .oc-items-table td:last-child,
.unidades-placas-board .oc-items-table th:last-child {
    width: 72px;
    text-align: center;
}.unidades-form-card {
    margin: 10px 0;
    padding: 10px;
}
.unidades-form-card .form-section {
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.unidades-form-card .form-grid,
.unidades-form-card .form-grid-4,
.unidades-form-card .form-grid-2 {
    gap: 10px;
}
.unidades-form-actions {
    margin-top: 10px;
    gap: 10px;
}
.unidades-form-card.is-maquinaria [data-soat-section],
.unidades-form-card.is-maquinaria .unidades-ident-upload {
    display: none !important;
}
.unidades-form-card.is-maquinaria .unidades-ident-split {
    grid-template-columns: 1fr;
}
.unidades-placas-board.is-maquinaria .unidades-col-soat,
.unidades-placas-board.is-maquinaria .unidades-td-soat {
    display: none;
}
.unidades-soat-na [data-soat-section],
.unidades-soat-na .unidades-ident-upload {
    opacity: 0.55;
    pointer-events: none;
}
.unidades-soat-na-note {
    margin: 0 0 10px;
    font-size: 12.5px;
    color: var(--text-muted);
}
.unidades-soat-na-note[hidden] {
    display: none !important;
}
.unidades-kind-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}
.unidades-kind-tab {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 14px);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.unidades-kind-tab.is-active {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    background: #e9f2ed;
}
@media (max-width: 960px) {
    .unidades-ident-split {
        grid-template-columns: 1fr;
    }
    .unidades-soat-drop-stage,
    .unidades-soat-drop-stage .unidades-soat-drop {
        min-height: 220px;
    }
}

/* Unidades y placas — wide historial table */
.unidades-placas-board .unidades-placas-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}
.unidades-placas-board .oc-items-table {
    min-width: 1860px;
    width: max-content;
}
.unidades-placas-board .oc-items-table th,
.unidades-placas-board .oc-items-table td {
    border-left: none !important;
    border-right: none !important;
    white-space: nowrap;
}
.unidades-placas-board .oc-items-table td:nth-child(17),
.unidades-placas-board .oc-items-table th:nth-child(17) {
    max-width: 220px;
    white-space: normal;
}

/* OCR / SOAT locked: same look, not-allowed cursor only */
.unidades-form-card 

/* Punto verde SOLO en el título Vehículo; nunca en el check Sin SOAT */
.form-section-title.unidades-veh-title .unidades-veh-title-main > span {
    width: 8px !important;
    height: 8px !important;
    min-width: 8px !important;
    min-height: 8px !important;
    border-radius: 50% !important;
    background: var(--primary) !important;
    display: inline-block !important;
    flex: 0 0 8px !important;
}
.form-section-title.unidades-veh-title .unidades-sin-soat-check,
.form-section-title.unidades-veh-title .unidades-sin-soat-check * {
    text-transform: none !important;
}
.form-section-title.unidades-veh-title .unidades-sin-soat-check span,
.form-section-title.unidades-veh-title .unidades-sin-soat-check .ios-checkbox-label {
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    display: inline !important;
    flex: 0 1 auto !important;
    white-space: nowrap !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    color: var(--text) !important;
    letter-spacing: normal !important;
}
.form-section-title.unidades-veh-title .unidades-sin-soat-check::before,
.form-section-title.unidades-veh-title .unidades-sin-soat-check span::before {
    content: none !important;
    display: none !important;
}

.is-ocr-locked,
.unidades-form-card .is-ocr-locked.field-control,
.unidades-form-card select.is-ocr-locked,
.unidades-form-card .is-ocr-locked:disabled,
.unidades-form-card input.is-ocr-locked[readonly] {
    opacity: 1 !important;
    cursor: not-allowed !important;
    background: var(--surface, var(--input-bg, transparent)) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
.unidades-form-card .select-picker.is-ocr-locked,
.unidades-form-card .date-picker.is-ocr-locked,
.unidades-form-card .select-picker.is-ocr-locked .select-picker-trigger,
.unidades-form-card .date-picker.is-ocr-locked .date-picker-trigger {
    opacity: 1 !important;
    cursor: not-allowed !important;
    pointer-events: none;
    background: var(--surface, transparent) !important;
    color: var(--text) !important;
}
.unidades-form-card .select-picker.is-ocr-locked button,
.unidades-form-card .date-picker.is-ocr-locked button {
    cursor: not-allowed !important;
    pointer-events: none;
}

/* ===== Sin SOAT: ios-checkbox scoped (mismo look Campana, tamaño header) ===== */
.form-section-title.unidades-veh-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    min-height: 0;
    margin: 0;
    padding: 0;
    /* misma altura visual que otros .form-section-title */
    line-height: 1.2;
}
.unidades-veh-title-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* Evitar que .form-section-title span agrande piezas del check */
.unidades-form-card .unidades-sin-soat-check.ios-checkbox,
.unidades-form-card .unidades-sin-soat-check .checkbox-wrapper,
.unidades-form-card .unidades-sin-soat-check .checkbox-bg,
.unidades-form-card .unidades-sin-soat-check .checkbox-icon,
.unidades-form-card .unidades-sin-soat-check .ios-checkbox-label,
.unidades-form-card .unidades-sin-soat-check span {
    width: auto;
    height: auto;
    border-radius: 0;
    background: transparent;
}

.unidades-form-card .unidades-sin-soat-check.ios-checkbox {
    --checkbox-size: 18px;
    --checkbox-color: #1f7a4d;
    --checkbox-bg: color-mix(in srgb, var(--primary) 16%, transparent);
    --checkbox-border: #6ee7b7;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    max-width: none;
    margin: 0 0 0 auto;
    padding: 0;
    border-radius: 0;
    background: transparent !important;
    cursor: pointer;
    user-select: none;
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}
.unidades-form-card .unidades-sin-soat-check.ios-checkbox:hover {
    background: transparent !important;
}
.unidades-form-card .unidades-sin-soat-check.ios-checkbox input {
    position: absolute !important;
    opacity: 0 !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    pointer-events: none;
    display: block !important; /* not display:none so :checked works if some browsers quirk; opacity 0 hides */
}
.unidades-form-card .unidades-sin-soat-check .checkbox-wrapper {
    position: relative;
    width: var(--checkbox-size) !important;
    height: var(--checkbox-size) !important;
    flex: 0 0 var(--checkbox-size) !important;
    border-radius: 5px !important;
    transition: transform 0.2s ease;
    overflow: visible;
}
.unidades-form-card .unidades-sin-soat-check .checkbox-bg {
    position: absolute !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    border-radius: 5px !important;
    border: 2px solid var(--checkbox-border) !important;
    background: var(--input-bg, var(--surface)) !important;
    transition: all 0.2s ease;
    box-sizing: border-box;
}
.unidades-form-card .unidades-sin-soat-check .checkbox-icon {
    position: absolute !important;
    inset: 0 !important;
    margin: auto !important;
    width: 12px !important;
    height: 12px !important;
    max-width: 12px !important;
    max-height: 12px !important;
    color: #fff !important;
    transform: scale(0);
    transition: transform 0.2s ease;
    display: block !important;
}
.unidades-form-card .unidades-sin-soat-check .check-path {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    transition: stroke-dashoffset 0.3s ease 0.1s;
}
.unidades-form-card .unidades-sin-soat-check.ios-checkbox input:checked + .checkbox-wrapper .checkbox-bg {
    background: var(--checkbox-color) !important;
    border-color: var(--checkbox-color) !important;
}
.unidades-form-card .unidades-sin-soat-check.ios-checkbox input:checked + .checkbox-wrapper .checkbox-icon {
    transform: scale(1);
}
.unidades-form-card .unidades-sin-soat-check.ios-checkbox input:checked + .checkbox-wrapper .check-path {
    stroke-dashoffset: 0;
}
.unidades-form-card .unidades-sin-soat-check .ios-checkbox-label {
    min-width: 0;
    margin: 0;
    padding: 0;
    font-size: 12.5px !important;
    line-height: 1.2 !important;
    font-weight: 600 !important;
    color: var(--text) !important;
    background: transparent !important;
    border-radius: 0 !important;
    white-space: nowrap;
    text-transform: none !important;
    letter-spacing: normal !important;
}
.unidades-form-card .unidades-sin-soat-check.ios-checkbox input:focus-visible + .checkbox-wrapper .checkbox-bg {
    box-shadow: 0 0 0 3px var(--checkbox-bg);
}

/* Idle/OCR locked: same look, not-allowed */
.unidades-form-card.is-form-idle .field-control:disabled,
.unidades-form-card.is-form-idle .field-select:disabled,
.unidades-form-card .is-ocr-locked,
.unidades-form-card .is-ocr-locked:disabled,
.unidades-form-card select.is-ocr-locked {
    opacity: 1 !important;
    cursor: not-allowed !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
.unidades-form-card.is-form-idle .select-picker,
.unidades-form-card.is-form-idle .date-picker,
.unidades-form-card .select-picker.is-ocr-locked,
.unidades-form-card .date-picker.is-ocr-locked {
    opacity: 1 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}
.unidades-form-card.is-form-idle .select-picker button,
.unidades-form-card.is-form-idle .date-picker button,
.unidades-form-card .select-picker.is-ocr-locked button,
.unidades-form-card .date-picker.is-ocr-locked button {
    cursor: not-allowed !important;
    pointer-events: none;
}


/* Alerta SOAT: reutiliza .alert-mark de forms.css (Facturas); variante ámbar */
.oc-items-table .alert-mark-warn {
    background: var(--warning-bg);
    color: var(--warning);
    box-shadow: 0 0 0 1px var(--warning);
}
.oc-items-table .alert-mark-warn svg {
    fill: none;
    stroke: #fff;
    stroke-width: 2.2;
}
.oc-items-table .alert-mark-warn .alert-triangle {
    fill: currentColor;
    stroke: currentColor;
}
.oc-items-table .th-alert,
.oc-items-table .td-alert {
    text-align: center;
    width: 56px;
}


/* Modo Ver: solo lectura (mismo fondo, cursor not-allowed) */
.unidades-form-card.is-form-view .field-control:disabled,
.unidades-form-card.is-form-view .field-select:disabled,
.unidades-form-card.is-form-view textarea:disabled,
.unidades-form-card.is-form-view .is-ocr-locked,
.unidades-form-card.is-form-view .is-ocr-locked:disabled,
.unidades-form-card.is-form-view select.is-ocr-locked {
    opacity: 1 !important;
    cursor: not-allowed !important;
    background: var(--surface, var(--input-bg, transparent)) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
.unidades-form-card.is-form-view .select-picker,
.unidades-form-card.is-form-view .date-picker,
.unidades-form-card.is-form-view .number-stepper.is-ocr-locked,
.unidades-form-card.is-form-view .select-picker.is-ocr-locked,
.unidades-form-card.is-form-view .date-picker.is-ocr-locked {
    opacity: 1 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}
.unidades-form-card.is-form-view .select-picker button,
.unidades-form-card.is-form-view .date-picker button,
.unidades-form-card.is-form-view .number-stepper-btn {
    cursor: not-allowed !important;
    pointer-events: none;
}
.unidades-form-card.is-form-view #ocrSoatDrop,
.unidades-form-card.is-form-view .unidades-sin-soat-check {
    cursor: not-allowed !important;
    pointer-events: none;
    opacity: 1 !important;
}
.unidades-form-card.is-form-view #ocrSoatPreview {
    pointer-events: auto;
    cursor: default;
}
.unidades-form-card.is-form-view #btnUnidadesGuardar[hidden] {
    display: none !important;
}


/* Maquinaria / hidden: el ios-checkbox usa display:inline-flex que anula [hidden] */
.unidades-form-card.is-maquinaria .unidades-sin-soat-check,
.unidades-form-card .unidades-sin-soat-check[hidden],
.unidades-form-card .unidades-sin-soat-check.is-hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}


/* Dropzone SOAT: preview oculto no debe tapar; drop restaurado visible */
.unidades-soat-drop-stage .unidades-soat-preview[hidden],
.unidades-soat-drop-stage #ocrSoatPreview[hidden] {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}
.unidades-soat-drop-stage .unidades-ocr-progress[hidden],
.unidades-soat-drop-stage #ocrSoatProgress[hidden] {
    display: none !important;
    pointer-events: none !important;
}
.unidades-soat-drop-stage .unidades-soat-drop:not([hidden]) {
    display: flex !important;
}


/* Editar: SOAT y check bloqueados (mismo fondo, not-allowed) */
.unidades-form-card.is-form-edit .unidades-sin-soat-check,
.unidades-form-card.is-form-edit .unidades-sin-soat-check.is-disabled {
    cursor: not-allowed !important;
    pointer-events: none;
    opacity: 1 !important;
}
.unidades-form-card.is-form-edit #ocrSoatDrop.is-busy,
.unidades-form-card.is-form-edit #btnSoatPreviewClear:disabled {
    cursor: not-allowed !important;
    opacity: 1 !important;
}


/* ===== Cursores Registros de unidades (regla final) =====
   not-allowed SOLO en controles realmente disabled / aria-disabled / is-ocr-locked del control.
   Nunca heredar not-allowed desde contenedores. */
.unidades-form-card .select-picker,
.unidades-form-card .date-picker,
.unidades-form-card .number-stepper,
.unidades-form-card .field,
.unidades-form-card.is-form-idle .select-picker,
.unidades-form-card.is-form-idle .date-picker,
.unidades-form-card.is-form-view .select-picker,
.unidades-form-card.is-form-view .date-picker,
.unidades-form-card.is-form-edit .select-picker,
.unidades-form-card.is-form-edit .date-picker,
.unidades-form-card .select-picker.is-ocr-locked,
.unidades-form-card .date-picker.is-ocr-locked,
.unidades-form-card .number-stepper.is-ocr-locked {
    cursor: unset !important; /* no forzar not-allowed en el wrapper */
}

/* Controles habilitados: texto */
.unidades-form-card input.field-control:not(:disabled):not([aria-disabled="true"]):not(.is-ocr-locked),
.unidades-form-card textarea.field-control:not(:disabled):not([aria-disabled="true"]):not(.is-ocr-locked),
.unidades-form-card input[type="text"]:not(:disabled):not([aria-disabled="true"]),
.unidades-form-card input[type="number"]:not(:disabled):not([aria-disabled="true"]),
.unidades-form-card input[type="search"]:not(:disabled):not([aria-disabled="true"]),
.unidades-placas-board input.field-control:not(:disabled),
.unidades-placas-board input[type="search"]:not(:disabled),
.unidades-placas-board .search:not(:disabled),
.unidades-placas-board input[type="text"]:not(:disabled) {
    cursor: text !important;
}

/* Controles habilitados: pointer (combos, fechas, stepper, check, botones) */
.unidades-form-card .select-picker:not(.is-ocr-locked) .select-picker-trigger:not(:disabled),
.unidades-form-card .date-picker:not(.is-ocr-locked) button:not(:disabled),
.unidades-form-card .date-picker:not(.is-ocr-locked) .date-picker-trigger:not(:disabled),
.unidades-form-card .number-stepper:not(.is-ocr-locked) .number-stepper-btn:not(:disabled),
.unidades-form-card button:not(:disabled):not([aria-disabled="true"]),
.unidades-form-card .unidades-sin-soat-check:not(.is-disabled):not([aria-disabled="true"]),
.unidades-form-card #ocrSoatDrop:not(.is-busy):not([aria-disabled="true"]),
.unidades-placas-board .select-picker:not(.is-ocr-locked) .select-picker-trigger:not(:disabled),
.unidades-placas-board button:not(:disabled),
.unidades-placas-board .icon-action:not(:disabled),
.unidades-kind-tab {
    cursor: pointer !important;
}

/* not-allowed SOLO en el control disabled / aria-disabled / locked */
.unidades-form-card input:disabled,
.unidades-form-card select:disabled,
.unidades-form-card textarea:disabled,
.unidades-form-card button:disabled,
.unidades-form-card input[aria-disabled="true"],
.unidades-form-card select[aria-disabled="true"],
.unidades-form-card textarea[aria-disabled="true"],
.unidades-form-card button[aria-disabled="true"],
.unidades-form-card input.is-ocr-locked,
.unidades-form-card select.is-ocr-locked,
.unidades-form-card textarea.is-ocr-locked,
.unidades-form-card .select-picker.is-ocr-locked .select-picker-trigger,
.unidades-form-card .date-picker.is-ocr-locked button,
.unidades-form-card .date-picker.is-ocr-locked .date-picker-trigger,
.unidades-form-card .number-stepper.is-ocr-locked .number-stepper-btn,
.unidades-form-card .number-stepper.is-ocr-locked input,
.unidades-form-card .unidades-sin-soat-check.is-disabled,
.unidades-form-card #ocrSoatDrop.is-busy,
.unidades-form-card #ocrSoatDrop[aria-disabled="true"],
.unidades-form-card #btnSoatPreviewClear:disabled,
.unidades-placas-board input:disabled,
.unidades-placas-board button:disabled,
.unidades-placas-board .select-picker.is-ocr-locked .select-picker-trigger {
    cursor: not-allowed !important;
}

/* Wrappers locked: bloquear interacción sin imponer cursor al form entero */
.unidades-form-card .select-picker.is-ocr-locked,
.unidades-form-card .date-picker.is-ocr-locked,
.unidades-form-card.is-form-idle .select-picker,
.unidades-form-card.is-form-idle .date-picker,
.unidades-form-card.is-form-view .select-picker,
.unidades-form-card.is-form-view .date-picker {
    pointer-events: none;
}


/* ===== Responsable (Registros-level UX) ===== */
.unidades-resp-split {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.75fr);
    gap: 10px;
    align-items: stretch;
}
.unidades-resp-fields {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.unidades-resp-fields .form-section {
    margin-bottom: 10px;
}
.unidades-resp-fields .unidades-form-actions {
    margin-top: 4px;
}
.unidades-resp-preview {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 18px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #eff6f3;
    text-align: center;
}
.unidades-resp-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent);
}
.unidades-resp-prev-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}
.unidades-resp-prev-meta {
    font-size: 12.5px;
    color: var(--text-muted);
}
.unidades-resp-preview .unidades-badge {
    margin-top: 4px;
}
@media (max-width: 960px) {
    .unidades-resp-split {
        grid-template-columns: 1fr;
    }
}
#respListBoard .unidades-filtros {
    margin: 0 10px 10px;
}


/* ===== Tabla Responsables: anchos + filas sin texto teñido ===== */
#respListBoard .oc-items-wrap,
#respListBoard .unidades-placas-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
#tblResponsables {
    min-width: 1880px;
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}
#tblResponsables td {
    padding: 10px 12px;
    vertical-align: middle;
    font-size: 13px;
    font-weight: 400;
    color: var(--text) !important; /* texto normal; el color va en badges */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Anchos fijos / min */
#tblResponsables th:nth-child(1),
#tblResponsables td:nth-child(1) { width: 90px; min-width: 90px; }   /* DNI */
#tblResponsables th:nth-child(2),
#tblResponsables td:nth-child(2) { width: 180px; min-width: 160px; white-space: normal; } /* Responsable */
#tblResponsables th:nth-child(3),
#tblResponsables td:nth-child(3) { width: 100px; min-width: 100px; } /* Celular */
#tblResponsables th:nth-child(4),
#tblResponsables td:nth-child(4) { width: 120px; min-width: 110px; } /* Licencia */
#tblResponsables th:nth-child(5),
#tblResponsables td:nth-child(5) { width: 90px; min-width: 90px; }   /* Categoría */
#tblResponsables th:nth-child(6),
#tblResponsables td:nth-child(6) { width: 100px; min-width: 100px; } /* Vence */
#tblResponsables th:nth-child(7),
#tblResponsables td:nth-child(7) { width: 110px; min-width: 110px; } /* Días */
#tblResponsables th:nth-child(8),
#tblResponsables td:nth-child(8) { width: 90px; min-width: 90px; }   /* Sede */
#tblResponsables th:nth-child(9),
#tblResponsables td:nth-child(9) { width: 140px; min-width: 120px; } /* Fundo */
#tblResponsables th:nth-child(10),
#tblResponsables td:nth-child(10) { width: 130px; min-width: 110px; } /* Departamento */
#tblResponsables th:nth-child(11),
#tblResponsables td:nth-child(11) { width: 100px; min-width: 90px; }  /* Área */
#tblResponsables th:nth-child(12),
#tblResponsables td:nth-child(12) { width: 120px; min-width: 100px; } /* Sub área */
#tblResponsables th:nth-child(13),
#tblResponsables td:nth-child(13) { width: 160px; min-width: 140px; white-space: normal; } /* Obs */
#tblResponsables th:nth-child(14),
#tblResponsables td:nth-child(14) { width: 90px; min-width: 90px; }  /* Estado */
#tblResponsables th:nth-child(15),
#tblResponsables td:nth-child(15) { width: 100px; min-width: 100px; overflow: visible; } /* Acciones */
#tblResponsables th:nth-child(16),
#tblResponsables td:nth-child(16) { width: 60px; min-width: 60px; text-align: center; overflow: visible; } /* Alerta */

/* Fondo sutil de estado; NO teñir tipografía de toda la fila (override forms.css) */
#tblResponsables tbody tr.is-within-limit td,
#tblResponsables tbody tr.is-over-limit td,
#tblResponsables tbody tr.is-status-aprobacion td {
    color: var(--text) !important;
    font-weight: 400 !important;
}
#tblResponsables tbody tr.is-within-limit td {
    background: #f2fbf6 !important;
}
#tblResponsables tbody tr.is-over-limit td {
    background: #fef3f3 !important;
}
#tblResponsables tbody tr.is-status-aprobacion td {
    background: #fffaec !important;
}
#tblResponsables tbody tr.is-within-limit td strong,
#tblResponsables tbody tr.is-over-limit td strong,
#tblResponsables tbody tr.is-status-aprobacion td strong {
    color: var(--text) !important;
    font-weight: 600 !important;
}
/* Badges / alerta conservan su color propio */
#tblResponsables .unidades-badge.ok { color: var(--success) !important; }
#tblResponsables .unidades-badge.warn { color: var(--warning) !important; }
#tblResponsables .unidades-badge.danger { color: var(--danger) !important; }
#tblResponsables .unidades-badge.mute { color: var(--text-muted) !important; }
#tblResponsables .td-alert { overflow: visible; }

/* Filtrar por — una fila, gaps 10px, labels arriba */
#respListBoard .unidades-filtros {
    display: block;
    margin: 0 0 10px 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-sizing: border-box;
}
#respListBoard .unidades-filtros > legend {
    width: auto;
    margin: 0 0 0 10px;
    padding: 0 8px;
    float: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
#respListBoard .unidades-filt-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
    min-width: 0;
}
#respListBoard .unidades-filt-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 0 1 160px;
}
#respListBoard .unidades-filt-search {
    flex: 1 1 220px;
    min-width: 180px;
}
#respListBoard .unidades-filt-k {
    font-size: 11px;
    font-weight: 650;
    color: var(--text-muted);
    line-height: 1.2;
}
#respListBoard .list-search.field-control,
#respListBoard input[type="search"].field-control {
    cursor: text !important;
}
#respListBoard .select-picker-trigger,
#respListBoard .unidades-filt-field .field-select {
    cursor: pointer !important;
}


/* ===== Responsable: márgenes 10px en los 4 lados (top = bottom) ===== */
body[data-page="unidades-responsable"] .content {
    padding: 10px !important;
    box-sizing: border-box;
}
body[data-page="unidades-responsable"] #frmUnidadResp.unidades-form-card {
    margin: 0 0 10px 0 !important;
    padding: 10px !important;
}
body[data-page="unidades-responsable"] #respListBoard.unidades-placas-board {
    margin: 0 !important;
    padding: 10px !important;
}
body[data-page="unidades-responsable"] #respListBoard .card-header {
    margin: 0 0 10px 0;
    padding: 0;
}
body[data-page="unidades-responsable"] #respListBoard .unidades-filtros {
    margin: 0 0 10px 0 !important;
    padding: 10px !important;
}
body[data-page="unidades-responsable"] #respListBoard .oc-items-wrap,
body[data-page="unidades-responsable"] #respListBoard .unidades-placas-scroll {
    margin: 0 !important;
    padding: 0;
}


/* Responsable/Obs: clamp en span interno; td sigue table-cell y hereda tint */
#tblResponsables td.td-clamp {
    white-space: normal;
    vertical-align: middle;
    overflow: hidden;
}
#tblResponsables .resp-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 0;
    margin: 0;
    color: inherit;
    font-weight: inherit;
    text-align: inherit;
}
#tblResponsables td > span:not(.unidades-badge):not(.alert-mark),
#tblResponsables td > div.table-actions {
    background: transparent !important;
}
#tblResponsables thead th {
    font-weight: 700;
    font-size: 10px;
    color: var(--primary) !important;
    background-color: var(--table-head-bg, var(--primary-soft)) !important;
}
