* { box-sizing: border-box; }
body { margin:0; font-family:"Segoe UI",Arial,sans-serif; background:#f4f7fb; color:#1f2937; }
a { color:#1f6fb2; text-decoration:none; }
a:hover { text-decoration:underline; }
.app-shell { min-height:100vh; display:flex; }
.sidebar { width:245px; background:#123a63; color:white; padding:24px 16px 16px; display:flex; flex-direction:column; position:fixed; top:0; bottom:0; left:0; overflow-y:auto; }
.brand { margin-bottom:24px; }
.brand-main { font-size:28px; font-weight:800; }
.brand-sub { color:#c7d7e8; font-size:13px; }
.sidebar nav { display:flex; flex-direction:column; gap:4px; }
.sidebar nav a { color:white; text-decoration:none; padding:11px 12px; border-radius:7px; font-weight:600; }
.sidebar nav a:hover { background:#1f5689; }
.sidebar-bottom { margin-top:auto; }
.user-box { display:flex; flex-direction:column; margin-bottom:10px; }
.user-box span,.sidebar small { color:#c7d7e8; font-size:12px; }
.logout-btn { width:100%; border:0; border-radius:7px; padding:10px; background:#204f7a; color:white; cursor:pointer; margin-bottom:12px; }
.content { margin-left:245px; padding:28px; width:calc(100% - 245px); }
h1,h2 { color:#7A271A; }
h1 { margin-top:0; }
.subtitle { color:#64748b; }
.cards { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:28px; }
.cards-6 { grid-template-columns:repeat(6,1fr); }
.card,.detail-card { background:white; border:1px solid #e2e8f0; border-radius:10px; padding:18px; }
.card strong { display:block; font-size:30px; color:#7A271A; }
.card span,.detail-card span { color:#64748b; }
.detail-card b { display:block; color:#7A271A; margin-bottom:5px; }
.detail-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:24px; }
.page-header { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:18px; }
.primary-btn,.secondary-btn,.danger-btn { display:inline-block; border:0; border-radius:7px; padding:10px 15px; font-weight:700; text-decoration:none; cursor:pointer; }
.primary-btn { background:#1f6fb2; color:white; }
.secondary-btn { background:white; color:#243b53; border:1px solid #cbd5e1; }
.danger-btn { background:#b42318; color:white; }
.table-wrap { background:white; border:1px solid #e2e8f0; border-radius:10px; overflow:auto; max-width:100%; }
table { width:100%; border-collapse:collapse; min-width:720px; }
th { background:#eaf1f8; color:#7A271A; text-align:left; padding:10px; white-space:nowrap; position:sticky; top:0; z-index:1; }
td { padding:10px; border-top:1px solid #edf2f7; vertical-align:top; }
.description { min-width:300px; white-space:normal; }
.warning-row { background:#fff4c2; }
.danger-row { background:#f8cccc; }
.success-row { background:#e4f5e8; }
.muted-row { background:#eceff1; color:#64748b; }
.filters { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:14px; }
.filters input,.filters select { min-height:38px; padding:7px 9px; border:1px solid #cbd5e1; border-radius:6px; background:white; }
.filters input { min-width:300px; }
.filters.links a { background:white; border:1px solid #cbd5e1; border-radius:6px; padding:8px 10px; }
.form-card { background:white; border:1px solid #e2e8f0; border-radius:10px; padding:22px; max-width:900px; margin-bottom:20px; }
.form-card.compact { padding:14px 18px; }
.form-card input,.form-card select,.form-card textarea { width:100%; padding:9px; border:1px solid #cbd5e1; border-radius:6px; margin-top:4px; }
.form-card input[type=checkbox] { width:auto; }
.form-card label { font-weight:600; }
.form-actions { display:flex; gap:10px; margin-top:18px; }
.message { padding:10px 14px; background:#e4f5e8; border:1px solid #b7dfc0; border-radius:7px; margin-bottom:15px; }
.message.error { background:#fde2e2; border-color:#efb0b0; }
.hint,.summary-line { color:#64748b; margin-bottom:12px; }
.ok-note { color:#2e7d32; font-weight:700; }
.empty-panel { background:white; border:1px solid #e2e8f0; border-radius:10px; padding:24px; }
.login-page { min-height:100vh; display:grid; place-items:center; background:#eef4fa; }
.login-card { width:min(420px,92vw); background:white; border:1px solid #dbe5ef; border-radius:12px; padding:30px; box-shadow:0 12px 30px rgba(18,58,99,.12); }
.login-card h1 { font-size:34px; margin-bottom:0; }
.login-card h2 { font-size:18px; margin-top:4px; color:#64748b; }
.login-card input { width:100%; padding:10px; border:1px solid #cbd5e1; border-radius:6px; }
@media(max-width:1200px){ .cards-6{grid-template-columns:repeat(3,1fr);} .detail-grid{grid-template-columns:repeat(2,1fr);} }
@media(max-width:900px){ .sidebar{width:190px;} .content{margin-left:190px;width:calc(100% - 190px);padding:18px;} .cards{grid-template-columns:repeat(2,1fr);} }
@media(max-width:650px){ .sidebar{position:static;width:100%;} .app-shell{display:block;} .content{margin-left:0;width:100%;padding:14px;} .cards,.cards-6,.detail-grid{grid-template-columns:1fr 1fr;} .page-header{align-items:flex-start;flex-direction:column;} .filters input{min-width:100%;} }


.active-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: -4px 0 12px;
}
.active-filters span {
    background: #eaf1f8;
    border: 1px solid #d5e2ee;
    border-radius: 999px;
    padding: 5px 10px;
    color: #36526c;
    font-size: 13px;
}


.close-panel {
    display: none;
    margin-top: 24px;
    padding: 18px;
    border: 2px solid #d6e4f0;
    border-radius: 10px;
    background: #f8fbfe;
}

.close-panel h2 {
    margin-top: 0;
}

.spare-question {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
    margin: 15px 0;
    padding: 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.spare-question label {
    display: flex;
    gap: 6px;
    align-items: center;
    font-weight: 600;
}

.spare-question input[type="radio"] {
    width: auto;
    margin: 0;
}

.spare-add-box {
    margin-top: 14px;
    padding: 14px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}


.assignment-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
    max-width: 900px;
    margin-bottom: 16px;
}

.assignment-summary > div {
    background: #eaf1f8;
    border: 1px solid #d5e2ee;
    border-radius: 9px;
    padding: 12px 14px;
}

.assignment-summary span {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 3px;
}

.assignment-summary strong {
    color: #7A271A;
}

.unassigned-badge {
    display: inline-block;
    background: #eceff1;
    color: #52606d;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
}

@media(max-width:650px){
    .assignment-summary { grid-template-columns: 1fr; }
}


.spares-external-section {
    display: none;
    max-width: 900px;
    margin-top: 18px;
}


.close-order-btn {
    background: #2f7d32 !important;
}

.spares-external-section {
    display: none;
    max-width: 900px;
    margin-top: 18px;
    padding: 18px;
    background: #f8fbfe;
    border: 2px solid #d6e4f0;
    border-radius: 10px;
}

.spare-add-card {
    margin-top: 14px;
}

.stock-info-box {
    background: #fff7df;
    border: 1px solid #f0d88b;
    border-radius: 8px;
    padding: 10px 12px;
    color: #7a5b00;
    margin-top: 12px;
}

.existing-spares {
    margin-top: 14px;
}


.preventive-spares-box {
    margin-top: 24px;
    padding: 18px;
    border: 2px solid #d6e4f0;
    border-radius: 10px;
    background: #f8fbfe;
}

.preventive-spares-box h2 {
    margin-top: 0;
}

.preventive-spare-row {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) 130px auto;
    gap: 12px;
    align-items: end;
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.preventive-spare-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.preventive-spare-row select,
.preventive-spare-row input {
    width: 100%;
}

@media(max-width: 760px) {
    .preventive-spare-row {
        grid-template-columns: 1fr;
    }
}


.info-card {
    max-width: 950px;
    padding: 12px 14px;
    margin-bottom: 16px;
    background: #eef6ff;
    border: 1px solid #cfe2f5;
    border-radius: 8px;
    color: #31526f;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.detail-grid > div {
    background: #f7f9fb;
    border: 1px solid #e2e8f0;
    padding: 12px;
    border-radius: 8px;
}

.detail-grid span {
    display: block;
    color: #64748b;
    font-size: 12px;
    margin-bottom: 4px;
}

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


.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.delete-btn {
    display: inline-block;
    background: #b42318;
    color: white !important;
    border: 1px solid #b42318;
    border-radius: 7px;
    padding: 10px 16px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.delete-btn:hover {
    background: #8f1c13;
    border-color: #8f1c13;
}

.delete-link {
    color: #b42318 !important;
    font-weight: 700;
}

.danger-confirm-card {
    max-width: 900px;
    background: white;
    border: 2px solid #efc2bd;
    border-radius: 10px;
    padding: 22px;
}

.warning-note {
    margin: 18px 0;
    padding: 12px 14px;
    background: #fff2f0;
    border: 1px solid #efc2bd;
    border-radius: 8px;
    color: #8f1c13;
    font-weight: 600;
}


.report-filters {
    display: grid;
    grid-template-columns: 150px 180px 180px 150px minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
    max-width: 1200px;
    margin-bottom: 18px;
    padding: 16px;
    background: white;
    border: 1px solid #dce5ee;
    border-radius: 10px;
}

.report-filters label {
    display: block;
    margin-bottom: 5px;
    font-weight: 700;
}

.report-filters input,
.report-filters select {
    width: 100%;
}

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.report-stat {
    background: white;
    border: 1px solid #dce5ee;
    border-radius: 10px;
    padding: 16px;
}

.report-stat span {
    display: block;
    color: #64748b;
    font-size: 13px;
    margin-bottom: 5px;
}

.report-stat strong {
    font-size: 24px;
    color: #7A271A;
}

@media(max-width: 980px) {
    .report-filters {
        grid-template-columns: repeat(2, 1fr);
    }

    .report-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width: 620px) {
    .report-filters,
    .report-summary-grid {
        grid-template-columns: 1fr;
    }
}


.export-stock-panel {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
    margin: 14px 0 18px;
    padding: 15px 16px;
    background: #f5f9fd;
    border: 1px solid #cfddea;
    border-radius: 10px;
}

.export-stock-panel h3 {
    margin: 0 0 4px;
    color: #7A271A;
}

.export-stock-panel p {
    margin: 0;
    color: #64748b;
}

.export-stock-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}


.pdf-export-btn {
    display: inline-block;
    background: #b42318;
    color: #ffffff !important;
    border: 1px solid #b42318;
    border-radius: 7px;
    padding: 10px 16px;
    text-decoration: none;
    font-weight: 700;
}

.pdf-export-btn:hover {
    background: #8f1c13;
    border-color: #8f1c13;
}


.closed-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e6b32;
    border: 1px solid #b7d9ba;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}

.cancelled-badge {
    display: inline-block;
    background: #f4f4f4;
    color: #666;
    border: 1px solid #d7d7d7;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}

.danger-outline-btn {
    display: inline-block;
    margin-left: 6px;
    padding: 8px 12px;
    border: 1px solid #b42318;
    border-radius: 7px;
    color: #b42318 !important;
    text-decoration: none;
    font-weight: 700;
    background: white;
}

.danger-outline-btn:hover {
    background: #fff2f0;
}

.small-muted {
    color: #75808a;
    font-size: 12px;
    margin-top: 4px;
}


.close-info-banner {
    max-width: 900px;
    margin: 0 0 14px;
    padding: 10px 13px;
    background: #e8f5e9;
    border: 1px solid #b7d9ba;
    border-radius: 8px;
    color: #2e6b32;
}


.machine-detail-actions {
    margin: 10px 0 16px;
}

.qr-label-page {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.qr-machine-label {
    width: 90mm;
    min-height: 115mm;
    box-sizing: border-box;
    border: 2px solid #B42318;
    border-radius: 10px;
    padding: 8mm;
    background: white;
    text-align: center;
    break-inside: avoid;
}

.qr-machine-label.compact {
    width: 82mm;
    min-height: 105mm;
    padding: 6mm;
}

.qr-brand {
    font-size: 22px;
    font-weight: 800;
    color: #B42318;
    letter-spacing: 1px;
}

.qr-machine-name {
    margin-top: 4px;
    font-size: 19px;
    font-weight: 800;
    color: #172B3A;
}

.qr-machine-line {
    margin-top: 2px;
    font-size: 12px;
    color: #64748b;
}

.qr-image {
    width: 54mm;
    height: 54mm;
    margin: 6mm auto 4mm;
    display: block;
    image-rendering: pixelated;
}

.qr-caption {
    font-weight: 700;
    font-size: 11px;
    color: #243746;
}

.qr-code-text {
    margin-top: 4px;
    font-size: 10px;
    color: #536577;
}

.qr-url-text {
    margin-top: 4px;
    font-size: 8px;
    color: #7b8794;
    word-break: break-all;
}

.qr-label-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(82mm, 1fr));
    gap: 8mm;
    align-items: start;
}

.qr-base-url-note {
    margin: 0 0 16px;
    padding: 10px 12px;
    background: #fff7df;
    border: 1px solid #f0d88b;
    border-radius: 8px;
}

@media print {
    .no-print,
    nav,
    .sidebar,
    header,
    footer {
        display: none !important;
    }

    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .qr-label-page {
        padding: 0 !important;
    }

    .qr-label-grid {
        display: grid;
        grid-template-columns: repeat(3, 82mm);
        gap: 5mm;
        justify-content: center;
    }

    .qr-machine-label {
        page-break-inside: avoid;
        break-inside: avoid;
        box-shadow: none !important;
    }
}


.dashboard-section-title {
    margin: 20px 0 10px;
    font-size: 14px;
    font-weight: 800;
    color: #607385;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(145px, 1fr));
    gap: 12px;
}

.dashboard-kpi,
.dashboard-month-card {
    display: block;
    background: #ffffff;
    border: 1px solid #dce5ee;
    border-radius: 10px;
    padding: 15px 16px;
    text-decoration: none !important;
    color: inherit !important;
}

.dashboard-kpi span,
.dashboard-month-card span {
    display: block;
    color: #607385;
    font-size: 12px;
    margin-bottom: 7px;
}

.dashboard-kpi strong,
.dashboard-month-card strong {
    display: block;
    color: #7A271A;
    font-size: 26px;
    line-height: 1.05;
}

.dashboard-kpi:hover {
    border-color: #9fb7c9;
    box-shadow: 0 2px 8px rgba(23, 70, 110, .08);
}

.danger-kpi {
    border-left: 4px solid #b42318;
}

.warning-kpi {
    border-left: 4px solid #d68a00;
}

.dashboard-month-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 12px;
}

.dashboard-two-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.dashboard-panel {
    margin-top: 18px;
    background: white;
    border: 1px solid #dce5ee;
    border-radius: 10px;
    padding: 16px;
}

.dashboard-two-columns .dashboard-panel {
    margin-top: 0;
}

.dashboard-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.dashboard-panel-header h2 {
    margin: 0;
    font-size: 18px;
}

.dashboard-panel-header a {
    font-size: 13px;
    font-weight: 700;
}

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

.dashboard-list-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 11px 4px;
    border-bottom: 1px solid #edf1f5;
    color: inherit !important;
    text-decoration: none !important;
}

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

.dashboard-list-row strong,
.dashboard-list-row span {
    display: block;
}

.dashboard-list-row span {
    color: #718096;
    font-size: 12px;
    margin-top: 2px;
}

.dashboard-date {
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
    color: #52697b;
}

.danger-text {
    color: #b42318 !important;
}

.dashboard-empty {
    padding: 14px 2px;
    color: #75808a;
}

.priority-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.priority-critica {
    color: #9c1c12;
    background: #fee7e4;
}

.priority-alta {
    color: #8a5100;
    background: #fff0d6;
}

.compact-table th,
.compact-table td {
    padding-top: 8px;
    padding-bottom: 8px;
}

.preventive-checklist-box {
    margin-top: 22px;
    padding: 18px;
    background: #f5f9fd;
    border: 2px solid #cdddea;
    border-radius: 10px;
}

.checklist-heading {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
}

.checklist-heading h2 {
    margin: 0 0 3px;
}

.checklist-heading p {
    margin: 0;
    color: #66798a;
}

.preventive-checklist-items {
    display: grid;
    gap: 8px;
}

.preventive-check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    background: white;
    border: 1px solid #dce5ee;
    border-radius: 8px;
    cursor: pointer;
}

.preventive-check-item input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex: 0 0 auto;
}

.preventive-check-item span {
    line-height: 1.35;
}

@media(max-width: 1150px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media(max-width: 760px) {
    .dashboard-kpi-grid,
    .dashboard-month-grid,
    .dashboard-two-columns {
        grid-template-columns: 1fr;
    }

    .checklist-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}


.dashboard-version-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #B42318;
    color: white;
    font-size: 12px;
    font-weight: 800;
}


/* PWA / móvil */
.pwa-install-wrap {
    margin: 8px 12px 12px;
}

.pwa-install-button {
    width: 100%;
    justify-content: center;
}

.pwa-install-help {
    margin-top: 8px;
    padding: 9px 10px;
    background: #FFF5F4;
    border: 1px solid #F4C7C3;
    border-radius: 8px;
    color: #7A271A;
    font-size: 12px;
    line-height: 1.35;
}

@media (max-width: 760px) {
    body {
        font-size: 15px;
    }

    .page-header {
        align-items: flex-start;
        gap: 10px;
    }

    .page-header,
    .header-actions,
    .form-actions {
        flex-direction: column;
    }

    .header-actions,
    .form-actions,
    .header-actions a,
    .header-actions button,
    .form-actions a,
    .form-actions button {
        width: 100%;
    }

    .primary-btn,
    .secondary-btn,
    .danger-outline-btn,
    .delete-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    input,
    select,
    textarea,
    button {
        font-size: 16px !important;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 720px;
    }

    .dashboard-kpi,
    .dashboard-month-card {
        min-height: 76px;
    }

    .preventive-check-item {
        min-height: 44px;
    }
}


/* Tema rojo CMC - V1.3.1 */
:root {
    --cmc-primary: #B42318;
    --cmc-primary-dark: #7A271A;
    --cmc-primary-light: #FEE4E2;
}

a {
    color: var(--cmc-primary);
}

.primary-btn {
    background: var(--cmc-primary) !important;
    border-color: var(--cmc-primary) !important;
    color: #fff !important;
}

.primary-btn:hover {
    background: var(--cmc-primary-dark) !important;
    border-color: var(--cmc-primary-dark) !important;
}

.secondary-btn {
    border-color: var(--cmc-primary) !important;
    color: var(--cmc-primary) !important;
}

.secondary-btn:hover {
    background: var(--cmc-primary-light) !important;
}

.qr-brand {
    color: var(--cmc-primary) !important;
}

.dashboard-version-badge {
    background: var(--cmc-primary) !important;
}



/* Logo superior CMC - V1.3.2 */
.brand-logo-wrap {
    display: block;
    margin-bottom: 8px;
}

.brand-logo {
    display: block;
    width: 100%;
    max-width: 210px;
    height: auto;
    object-fit: contain;
    background: white;
    border-radius: 6px;
    padding: 4px;
}

@media (max-width: 900px) {
    .brand-logo {
        max-width: 160px;
    }
}

/* =========================================================
   CMC V1.3.3 - barra lateral roja + logo corporativo
   ========================================================= */
.sidebar {
    background: #B42318 !important;
    color: #ffffff !important;
}

.brand {
    background: transparent !important;
    border-bottom: 1px solid rgba(255,255,255,.22) !important;
    padding: 18px 14px 16px !important;
}

.brand-logo-wrap {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 64px !important;
    margin-bottom: 8px !important;
    background: #ffffff !important;
    border-radius: 10px !important;
    padding: 8px 10px !important;
    box-sizing: border-box !important;
}

.brand-logo {
    display: block !important;
    max-width: 170px !important;
    width: 100% !important;
    height: auto !important;
    max-height: 58px !important;
    object-fit: contain !important;
}

.brand-sub {
    color: #ffffff !important;
    text-align: center !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    letter-spacing: .02em !important;
}

.sidebar nav a {
    color: #ffffff !important;
}

.sidebar nav a:hover,
.sidebar nav a:focus,
.sidebar nav a.active {
    background: rgba(255,255,255,.16) !important;
    color: #ffffff !important;
}

.sidebar-bottom,
.sidebar-bottom .user-box,
.sidebar-bottom .user-box strong,
.sidebar-bottom .user-box span,
.sidebar-bottom small {
    color: #ffffff !important;
}

.sidebar .logout-btn {
    background: rgba(255,255,255,.10) !important;
    border-color: rgba(255,255,255,.50) !important;
    color: #ffffff !important;
}

.sidebar .logout-btn:hover {
    background: rgba(255,255,255,.20) !important;
}

.sidebar .pwa-install-button {
    background: #ffffff !important;
    color: #B42318 !important;
    border-color: #ffffff !important;
}

.sidebar .pwa-install-help {
    background: rgba(255,255,255,.12) !important;
    border-color: rgba(255,255,255,.30) !important;
    color: #ffffff !important;
}


/* V1.4.0 - trabajo móvil */
.mobile-nav-highlight {
    font-weight: 800 !important;
}

.photo-thumb {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 7px;
    border: 1px solid rgba(0,0,0,.12);
}

.photo-preview-card {
    margin: 0 0 14px;
    padding: 12px;
    background: #fff;
    border: 1px solid #ead4d1;
    border-radius: 10px;
}

.photo-preview-card strong {
    display: block;
    margin-bottom: 8px;
}

.photo-preview-card img {
    display: block;
    width: 100%;
    max-width: 420px;
    max-height: 280px;
    object-fit: contain;
    border-radius: 8px;
}

.mobile-tech-page {
    max-width: 900px;
    margin: 0 auto;
}

.mobile-tech-head h1 {
    margin-bottom: 2px;
}

.mobile-tech-head p {
    margin-top: 0;
    color: #667788;
}

.mobile-action-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.mobile-action {
    display: flex;
    min-height: 118px;
    padding: 16px;
    border-radius: 12px;
    background: white;
    border: 1px solid #ead4d1;
    text-decoration: none !important;
    flex-direction: column;
    justify-content: center;
    color: #382522 !important;
}

.mobile-action.primary {
    background: #B42318;
    color: white !important;
    border-color: #B42318;
}

.mobile-action-icon {
    font-size: 27px;
    line-height: 1;
    margin-bottom: 10px;
}

.mobile-action strong,
.mobile-action small {
    display: block;
}

.mobile-action small {
    margin-top: 4px;
    opacity: .75;
}

.mobile-panel {
    margin-top: 18px;
    padding: 14px;
    background: white;
    border: 1px solid #ead4d1;
    border-radius: 12px;
}

.mobile-panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.mobile-panel-title h2 {
    margin: 0;
    font-size: 18px;
}

.mobile-order-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 13px 4px;
    border-bottom: 1px solid #f0e4e2;
    color: inherit !important;
    text-decoration: none !important;
}

.mobile-order-card:last-child {
    border-bottom: 0;
}

.mobile-order-card strong,
.mobile-order-card span,
.mobile-order-card small {
    display: block;
}

.mobile-order-card span,
.mobile-order-card small {
    margin-top: 3px;
    color: #6f625f;
}

.mobile-order-right {
    text-align: right;
}

.scanner-card {
    max-width: 680px;
    background: white;
    border: 1px solid #ead4d1;
    border-radius: 12px;
    padding: 18px;
}

.scanner-reader {
    width: 100%;
    min-height: 80px;
    overflow: hidden;
    border-radius: 10px;
}

.scanner-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.scanner-file-label {
    cursor: pointer;
}

.scanner-help {
    color: #667788;
    font-size: 13px;
    line-height: 1.45;
}

.scanner-result {
    margin-top: 12px;
    font-weight: 700;
}

.scanner-manual {
    margin-top: 18px;
}

.scanner-manual input {
    width: 100%;
    box-sizing: border-box;
    margin: 10px 0;
}

@media (max-width: 760px) {
    .mobile-action-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mobile-action {
        min-height: 126px;
    }

    .scanner-actions {
        flex-direction: column;
    }

    .scanner-actions > * {
        width: 100%;
        box-sizing: border-box;
        justify-content: center;
    }
}


/* V1.4.1 - MTBF / MTTR */
.machine-kpi-section {
    margin: 18px 0;
    padding: 16px;
    background: #fff;
    border: 1px solid #ead4d1;
    border-radius: 12px;
}

.machine-kpi-section h2 {
    margin-top: 0;
}

.machine-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.machine-kpi-card {
    padding: 14px;
    border-radius: 10px;
    background: #fff7f6;
    border: 1px solid #f1d1cd;
}

.machine-kpi-card span,
.machine-kpi-card small {
    display: block;
}

.machine-kpi-card span {
    color: #75605c;
    font-size: 12px;
}

.machine-kpi-card strong {
    display: block;
    margin: 6px 0 4px;
    color: #7A271A;
    font-size: 24px;
}

.machine-kpi-card small {
    color: #8c7975;
    font-size: 11px;
}

.machine-kpi-note {
    margin-top: 12px;
    color: #75605c;
    font-size: 12px;
    line-height: 1.5;
}

.report-metrics-panel {
    margin-top: 22px;
}

@media (max-width: 760px) {
    .machine-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.notification-bell{display:flex;align-items:center;justify-content:space-between;margin:8px 12px;padding:10px 12px;border-radius:8px;background:rgba(255,255,255,.13);color:#fff!important;text-decoration:none!important;font-weight:700}
.notification-count{min-width:22px;height:22px;border-radius:999px;background:#fff;color:#B42318;display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:900}
.notification-popup-overlay{position:fixed;inset:0;z-index:5000;display:flex;align-items:center;justify-content:center;padding:18px;background:rgba(31,21,19,.55)}
.notification-popup-card{position:relative;width:min(480px,100%);background:#fff;border-radius:14px;padding:20px;box-shadow:0 20px 60px rgba(0,0,0,.25)}
.notification-popup-close{position:absolute;right:10px;top:7px;border:0;background:transparent;font-size:30px;cursor:pointer}
.notification-popup-head{display:flex;gap:12px;align-items:center}
.notification-popup-symbol{width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#fee4e2;font-size:22px}
.notification-popup-body{margin:18px 0;padding:15px;border-radius:10px;background:#fff7f6;border:1px solid #f2d5d1}
.notification-popup-actions,.notification-card-actions{display:flex;flex-wrap:wrap;gap:8px}
.notification-type{display:inline-block;padding:3px 7px;border-radius:999px;background:#fee4e2;color:#9d2016;font-size:10px;font-weight:800;text-transform:uppercase}
.notifications-list{display:grid;gap:10px}
.notification-card{display:flex;justify-content:space-between;gap:18px;align-items:center;background:#fff;border:1px solid #e5d9d6;border-radius:10px;padding:14px 16px}
.notification-card.unseen{border-left:5px solid #B42318;background:#fffafa}
.notification-new{margin-left:6px;color:#B42318;font-size:10px;font-weight:900}
@media(max-width:760px){.notification-card{align-items:stretch;flex-direction:column}.notification-popup-actions,.notification-popup-actions form,.notification-popup-actions a,.notification-popup-actions button{width:100%}}


/* V1.4.3 - cronómetro OT y comentarios */
.work-timer-card{background:#fff;border:1px solid #ead8d4;border-left:5px solid #b42318;border-radius:12px;padding:16px 18px;margin:14px 0 18px;box-shadow:0 3px 12px rgba(0,0,0,.05)}
.work-timer-top{display:flex;justify-content:space-between;gap:14px;align-items:flex-start}
.timer-label{display:block;font-size:11px;font-weight:900;letter-spacing:.06em;color:#8d7772}
.timer-value{display:block;font-size:28px;line-height:1.15;margin:4px 0;color:#2d2422}
.timer-running{display:inline-block;color:#14804a;font-weight:800;font-size:12px}
.timer-stopped{display:inline-block;color:#746864;font-size:12px}
.timer-status-badge{padding:7px 10px;border-radius:999px;background:#f5ecea;font-weight:800;font-size:12px;white-space:nowrap}
.timer-actions{display:flex;flex-wrap:wrap;gap:9px;margin-top:15px;align-items:center}
.timer-actions form{margin:0}
.pause-form{display:flex;gap:7px;align-items:center}
.pause-form select{min-width:180px}
.timer-start-btn,.timer-pause-btn,.timer-finish-btn{border:0;border-radius:8px;padding:10px 13px;font-weight:800;cursor:pointer}
.timer-start-btn{background:#177245;color:#fff}
.timer-pause-btn{background:#e9a23b;color:#251b0f}
.timer-finish-btn{background:#b42318;color:#fff}
.timer-help{font-size:12px;color:#746864;margin-top:12px}
.comments-section{margin-top:22px}
.comments-timeline{display:grid;gap:9px;margin:12px 0}
.comment-item{background:#fff;border:1px solid #e7ddda;border-radius:9px;padding:11px 13px}
.comment-meta{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:6px;font-size:12px}
.comment-meta span{color:#857773;white-space:nowrap}
.comment-text{white-space:normal;color:#3d3432}
.empty-comments{padding:14px;border:1px dashed #d9cbc8;border-radius:9px;color:#81736f;background:#faf8f7}
.comment-add-card{margin-top:10px}
@media(max-width:760px){.work-timer-top{flex-direction:column}.timer-value{font-size:25px}.timer-actions,.timer-actions form,.timer-actions button{width:100%}.pause-form{flex-direction:column;align-items:stretch}.pause-form select{width:100%;min-width:0}.comment-meta{align-items:flex-start;flex-direction:column;gap:2px}}


/* V1.4.4 - Turnos automáticos de técnicos */
.technician-shift-dashboard {
    display: grid;
    grid-template-columns: minmax(250px, 1.25fr) minmax(180px, .75fr) minmax(320px, 1.5fr);
    gap: 12px;
    margin: 0 0 22px;
}

.technician-shift-current,
.technician-shift-next,
.technician-shift-week {
    background: #fff;
    border: 1px solid #eadfdd;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}

.technician-shift-current {
    border-left: 5px solid #B42318;
    background: linear-gradient(135deg, #fff 0%, #fff7f6 100%);
}

.technician-shift-label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #8f1d15;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
}

.technician-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #21a366;
    box-shadow: 0 0 0 4px rgba(33, 163, 102, .12);
}

.technician-shift-name {
    margin-top: 10px;
    color: #261b19;
    font-size: 28px;
    line-height: 1;
    font-weight: 900;
}

.technician-shift-meta {
    margin-top: 8px;
    color: #6e5f5c;
    font-weight: 700;
}

.technician-shift-next {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.technician-shift-next span,
.technician-shift-week-title {
    color: #7d6d69;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.technician-shift-next strong {
    margin-top: 7px;
    font-size: 21px;
}

.technician-shift-next small {
    margin-top: 4px;
    color: #746663;
}

.technician-shift-week-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-top: 9px;
}

.technician-shift-mini {
    padding: 9px;
    border-radius: 8px;
    background: #f8f5f4;
    border: 1px solid transparent;
}

.technician-shift-mini.active {
    background: #fff1ef;
    border-color: #e9b5ae;
}

.technician-shift-mini span,
.technician-shift-mini strong,
.technician-shift-mini small {
    display: block;
}

.technician-shift-mini span {
    color: #796a67;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.technician-shift-mini strong {
    margin-top: 4px;
    font-size: 15px;
}

.technician-shift-mini small {
    margin-top: 3px;
    color: #7d706d;
    font-size: 10px;
}

@media (max-width: 1050px) {
    .technician-shift-dashboard {
        grid-template-columns: 1fr 1fr;
    }

    .technician-shift-week {
        grid-column: 1 / -1;
    }
}

@media (max-width: 650px) {
    .technician-shift-dashboard {
        grid-template-columns: 1fr;
    }

    .technician-shift-week {
        grid-column: auto;
    }

    .technician-shift-week-grid {
        grid-template-columns: 1fr;
    }

    .technician-shift-name {
        font-size: 25px;
    }
}


/* ============================================================
   V1.5.0 - SCADA visual STORTI
   ============================================================ */
.scada-panel {
    margin: 0 0 24px;
    padding: 18px;
    border: 1px solid #ded5d2;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.scada-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.scada-eyebrow {
    color: #9e241b;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}

.scada-panel h2 {
    margin: 3px 0 2px;
    font-size: 22px;
}

.scada-panel-head p {
    margin: 0;
    color: #746966;
    font-size: 13px;
}

.scada-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.scada-summary-item {
    min-width: 78px;
    padding: 7px 9px;
    border-radius: 9px;
    background: #f6f3f2;
    text-align: center;
}

.scada-summary-item strong,
.scada-summary-item span {
    display: block;
}

.scada-summary-item strong {
    font-size: 18px;
    line-height: 1;
}

.scada-summary-item span {
    margin-top: 4px;
    color: #716562;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.summary-ok { border-bottom: 3px solid #2d9d62; }
.summary-fault { border-bottom: 3px solid #c52f28; }
.summary-maintenance { border-bottom: 3px solid #e27b22; }
.summary-waiting { border-bottom: 3px solid #d5a515; }

.scada-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 15px 0 11px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f7f5f4;
    color: #655b58;
    font-size: 11px;
    font-weight: 700;
}

.scada-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.scada-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.dot-ok { background: #2d9d62; }
.dot-fault { background: #c52f28; }
.dot-maintenance { background: #e27b22; }
.dot-waiting { background: #d5a515; }
.dot-offline { background: #777; }
.dot-unlinked { background: #bbb; }

.scada-scroll {
    overflow-x: auto;
    padding: 8px 2px 12px;
    -webkit-overflow-scrolling: touch;
}

.scada-line {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 1290px;
    padding: 28px 2px 12px;
}

.scada-line::before {
    content: "";
    position: absolute;
    left: 52px;
    right: 52px;
    top: 50%;
    height: 7px;
    border-radius: 6px;
    background:
        repeating-linear-gradient(
            90deg,
            #706965 0,
            #706965 18px,
            #8b817d 18px,
            #8b817d 26px
        );
    opacity: .30;
    z-index: 0;
}

.scada-machine {
    position: relative;
    z-index: 2;
    width: 112px;
    min-width: 112px;
    min-height: 194px;
    padding: 9px 8px 10px;
    border: 2px solid #cbc2bf;
    border-radius: 11px;
    background: #fff;
    color: #2e2624;
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 3px 10px rgba(41, 31, 29, .07);
    transition: transform .12s ease, box-shadow .12s ease;
}

@media (hover: hover) and (pointer: fine) {
    .scada-machine:hover {
        transform: translateY(-3px);
        box-shadow: 0 7px 18px rgba(41, 31, 29, .14);
    }
}

.scada-machine-top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.scada-mode {
    padding: 2px 5px;
    border-radius: 999px;
    background: #ece8e6;
    color: #655c59;
    font-size: 8px;
    line-height: 1.4;
    font-weight: 900;
    letter-spacing: .04em;
}

.scada-mode.manual {
    background: #3c3030;
    color: #fff;
}

.scada-status-light {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #aaa;
    box-shadow: 0 0 0 4px rgba(0,0,0,.05);
}

.scada-machine-glyph {
    position: relative;
    width: 86px;
    height: 58px;
    margin: 12px 0 7px;
}

.glyph-base {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 10px;
    height: 8px;
    border-radius: 3px;
    background: #4e4946;
}

.glyph-body {
    position: absolute;
    left: 20px;
    bottom: 17px;
    width: 47px;
    height: 28px;
    border: 3px solid #6c6460;
    border-radius: 5px 5px 2px 2px;
    background: #f3f0ef;
}

.glyph-head {
    position: absolute;
    left: 33px;
    bottom: 44px;
    width: 22px;
    height: 8px;
    border-radius: 3px 3px 0 0;
    background: #6c6460;
}

.glyph-wheel {
    position: absolute;
    bottom: 2px;
    width: 10px;
    height: 10px;
    border: 2px solid #5f5754;
    border-radius: 50%;
    background: #fff;
}

.wheel-a { left: 18px; }
.wheel-b { right: 18px; }

/* Variaciones de silueta para que cada tramo sea reconocible */
.scada-shape-robot .glyph-body {
    left: 38px;
    width: 18px;
    height: 30px;
    border-radius: 10px;
}
.scada-shape-robot .glyph-head {
    left: 19px;
    bottom: 39px;
    width: 29px;
    height: 7px;
    transform: rotate(-28deg);
    transform-origin: right center;
}
.scada-shape-nailer .glyph-body {
    left: 14px;
    width: 60px;
    height: 34px;
}
.scada-shape-nailer .glyph-head {
    left: 21px;
    width: 46px;
}
.scada-shape-turner .glyph-body {
    left: 27px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
}
.scada-shape-conveyor .glyph-body,
.scada-shape-outfeed .glyph-body {
    left: 5px;
    bottom: 21px;
    width: 76px;
    height: 11px;
}
.scada-shape-mill .glyph-body {
    left: 12px;
    width: 64px;
    height: 25px;
    border-top: 7px double #6c6460;
}
.scada-shape-stamp .glyph-body {
    left: 24px;
    width: 40px;
    height: 28px;
}
.scada-shape-stamp .glyph-head {
    left: 38px;
    width: 13px;
    height: 13px;
}

.scada-machine-name {
    width: 100%;
    text-align: center;
    font-size: 14px;
    line-height: 1.05;
}

.scada-machine-subtitle {
    min-height: 25px;
    margin-top: 4px;
    text-align: center;
    color: #766b67;
    font-size: 9px;
    line-height: 1.2;
}

.scada-state-label {
    width: 100%;
    margin-top: 8px;
    padding: 5px 3px;
    border-radius: 6px;
    text-align: center;
    font-size: 8px;
    line-height: 1.2;
    font-weight: 900;
    letter-spacing: .02em;
    background: #efedec;
}

.scada-machine-reference {
    margin-top: 5px;
    color: #716461;
    font-size: 9px;
    font-weight: 800;
}

.scada-state-ok { border-color: #60b886; }
.scada-state-ok .scada-status-light { background: #2d9d62; }
.scada-state-ok .scada-state-label { background: #e8f6ee; color: #17643d; }

.scada-state-fault { border-color: #d5645e; background: #fff8f7; }
.scada-state-fault .scada-status-light { background: #c52f28; }
.scada-state-fault .scada-state-label { background: #fde9e7; color: #98221c; }

.scada-state-maintenance { border-color: #e8a05f; background: #fffaf5; }
.scada-state-maintenance .scada-status-light { background: #e27b22; }
.scada-state-maintenance .scada-state-label { background: #fff0df; color: #9a4c0b; }

.scada-state-waiting { border-color: #dfc04c; background: #fffdf4; }
.scada-state-waiting .scada-status-light { background: #d5a515; }
.scada-state-waiting .scada-state-label { background: #fff6ca; color: #7d6000; }

.scada-state-offline {
    border-color: #96908d;
    background: #f4f3f2;
    filter: grayscale(.45);
}
.scada-state-offline .scada-status-light { background: #777; }
.scada-state-offline .scada-state-label { background: #e4e2e1; color: #555; }

.scada-state-unlinked {
    border-style: dashed;
    border-color: #c6c1bf;
    background: #fafafa;
    opacity: .78;
}
.scada-state-unlinked .scada-status-light { background: #bbb; }
.scada-state-unlinked .scada-state-label { background: #eee; color: #777; }

.scada-connector {
    position: relative;
    z-index: 3;
    width: 24px;
    min-width: 24px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scada-connector span {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #8c817d;
}
.scada-connector b {
    position: relative;
    margin-left: 15px;
    color: #8c817d;
    background: #fff;
    font-size: 24px;
    line-height: 1;
}

.scada-flow-label {
    position: relative;
    z-index: 3;
    min-width: 55px;
    color: #7b6e6a;
    font-size: 9px;
    font-weight: 900;
    text-align: center;
    letter-spacing: .05em;
}

.scada-flow-start { margin-right: 8px; }
.scada-flow-end { margin-left: 8px; }

.scada-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding-top: 9px;
    border-top: 1px solid #eee8e6;
    color: #756a66;
    font-size: 10px;
}
.scada-foot a {
    margin-left: auto;
}

/* Control SCADA en ficha de máquina */
.machine-scada-control {
    margin: 16px 0 20px;
    border: 1px solid #e2d9d6;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.machine-scada-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 16px;
    border-left: 6px solid #aaa;
}

.machine-scada-status.scada-state-ok { border-left-color: #2d9d62; background: #f6fcf8; }
.machine-scada-status.scada-state-fault { border-left-color: #c52f28; background: #fff7f6; }
.machine-scada-status.scada-state-maintenance { border-left-color: #e27b22; background: #fff9f3; }
.machine-scada-status.scada-state-waiting { border-left-color: #d5a515; background: #fffdf4; }
.machine-scada-status.scada-state-offline { border-left-color: #777; background: #f5f4f4; }

.machine-scada-kicker {
    display: block;
    color: #786b67;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .06em;
}

.machine-scada-status strong {
    display: block;
    margin-top: 2px;
    font-size: 20px;
}

.machine-scada-status small {
    display: block;
    margin-top: 4px;
    color: #6f6461;
}

.machine-scada-admin {
    padding: 14px 16px 16px;
    border-top: 1px solid #eee7e5;
}

.machine-scada-admin h3 {
    margin: 0 0 3px;
    font-size: 15px;
}
.machine-scada-admin p {
    margin: 0 0 12px;
    color: #746a66;
    font-size: 12px;
}

.machine-scada-form {
    display: grid;
    grid-template-columns: minmax(180px, .7fr) minmax(260px, 1.3fr) auto;
    gap: 10px;
    align-items: end;
}
.machine-scada-form label {
    display: grid;
    gap: 5px;
    color: #655b58;
    font-size: 11px;
    font-weight: 800;
}
.machine-scada-form select,
.machine-scada-form input {
    min-height: 39px;
    padding: 7px 9px;
    border: 1px solid #ccc1be;
    border-radius: 7px;
    background: #fff;
    font-size: 14px;
}

.machine-scada-auto-form {
    margin-top: 10px;
}

.machine-scada-last-change {
    margin-top: 7px;
    color: #817572;
    font-size: 10px;
}

@media (max-width: 820px) {
    .scada-panel-head {
        flex-direction: column;
    }
    .scada-summary {
        justify-content: flex-start;
    }
    .machine-scada-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .scada-panel {
        padding: 13px;
    }
    .scada-summary-item {
        min-width: 68px;
    }
    .scada-machine {
        width: 104px;
        min-width: 104px;
    }
}


/* SCADA gráfico V1.5.1 */
.scada-graphic-wrap {
    margin-top: 18px;
    margin-bottom: 18px;
}

.scada-graphic-stage {
    position: relative;
    overflow-x: auto;
    padding: 14px;
    border: 1px solid #e4e8ef;
    border-radius: 20px;
    background: linear-gradient(180deg, #fafbfc 0%, #f2f5f8 100%);
}

.scada-graphic-image {
    display: block;
    width: 100%;
    min-width: 1080px;
    height: auto;
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(10, 20, 30, 0.06);
}

.scada-hotspot {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px 8px;
    border: 2px solid transparent;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(2px);
    text-decoration: none;
    box-shadow: 0 10px 20px rgba(12, 25, 45, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.scada-hotspot:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(12, 25, 45, 0.12);
}

.scada-hotspot-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #0f2c46;
}

.scada-hotspot-header b {
    font-size: 0.76rem;
    letter-spacing: 0.02em;
}

.scada-hotspot-header small {
    margin-left: auto;
    font-size: 0.62rem;
    font-weight: 700;
    color: #6b7280;
}

.scada-hotspot-state {
    margin-top: 6px;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.1;
    color: #0f172a;
}

.scada-hotspot-ref {
    margin-top: 6px;
    font-size: 0.62rem;
    color: #5c6470;
}

.scada-line-compact {
    gap: 10px;
    padding-top: 8px;
}

.scada-machine-mini {
    min-width: 118px;
    padding: 10px 12px;
}

.scada-machine-mini .scada-machine-name {
    font-size: 0.82rem;
}

.scada-machine-mini .scada-state-label {
    margin-top: 8px;
    font-size: 0.63rem;
}

@media (max-width: 900px) {
    .scada-graphic-stage {
        padding: 10px;
    }

    .scada-hotspot {
        padding: 5px 6px;
        border-radius: 10px;
    }

    .scada-hotspot-header b {
        font-size: 0.67rem;
    }

    .scada-hotspot-header small,
    .scada-hotspot-state,
    .scada-hotspot-ref {
        font-size: 0.56rem;
    }
}


/* ============================================================
   V1.5.2 - SCADA SVG realista
   La propia silueta de la máquina cambia de color según estado.
   ============================================================ */
.scada-svg-wrap {
    width: 100%;
    overflow-x: auto;
    margin: 12px 0 4px;
    padding: 2px 0 10px;
    -webkit-overflow-scrolling: touch;
}
.scada-svg {
    display: block;
    width: 100%;
    min-width: 1180px;
    height: auto;
    font-family: inherit;
}
.scada-svg-backdrop {
    fill: #f4f7f9;
    stroke: #d6dde3;
    stroke-width: 2;
}
.scada-svg-title {
    fill: #253241;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: .03em;
}
.scada-svg-subtitle {
    fill: #708090;
    font-size: 12px;
    font-weight: 600;
}
.scada-svg-flow {
    fill: none;
    stroke: #aeb8c1;
    stroke-width: 10;
    stroke-linecap: round;
}
.scada-svg-roller-bed {
    fill: none;
    stroke: #cbd3da;
    stroke-width: 18;
    stroke-linecap: round;
}
.scada-svg-arrow { fill: #8c99a5; }
.scada-svg-end-label {
    fill: #6f7b87;
    font-size: 12px;
    font-weight: 800;
}
.scada-svg-machine {
    cursor: pointer;
    text-decoration: none;
    outline: none;
}
.scada-svg-machine .machine-shell {
    fill: #e7f6ed;
    stroke: #2e8e59;
    stroke-width: 4;
    transition: fill .15s ease, stroke .15s ease, opacity .15s ease;
}
.scada-svg-machine .machine-secondary { fill: #d8f0e2; }
.scada-svg-machine .machine-core {
    fill: #39a967;
    stroke: #25794b;
    stroke-width: 2;
}
.scada-svg-machine .machine-metal {
    fill: #8d99a5;
    stroke: #65727e;
    stroke-width: 2;
}
.scada-svg-machine .machine-arm,
.scada-svg-machine .machine-gripper {
    fill: none;
    stroke: #39a967;
    stroke-width: 18;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.scada-svg-machine .machine-gripper { stroke-width: 8; }
.scada-svg-machine .machine-detail {
    fill: none;
    stroke: #526170;
    stroke-width: 4;
    stroke-linecap: round;
}
.scada-svg-machine .machine-detail.heavy { stroke-width: 7; }
.scada-svg-machine .machine-wheel {
    fill: #dfe5ea;
    stroke: #65727e;
    stroke-width: 2;
}
.scada-svg-machine .machine-cutout {
    fill: #f4f7f9;
    stroke: #25794b;
    stroke-width: 2;
}
.scada-svg-machine .machine-name {
    fill: #1d2a36;
    font-size: 18px;
    font-weight: 900;
    pointer-events: none;
}
.scada-svg-machine .machine-name.small { font-size: 15px; }
.scada-svg-machine .machine-role {
    fill: #546372;
    font-size: 10px;
    font-weight: 800;
    pointer-events: none;
}
.scada-svg-mode-bg { fill: #ffffff; stroke: #c7d0d8; stroke-width: 1.5; }
.scada-svg-mode-text { fill: #566473; font-size: 10px; font-weight: 900; }
.scada-svg-state-bg { fill: #2f9c60; }
.scada-svg-state-text { fill: white; font-size: 9px; font-weight: 900; letter-spacing: .03em; }

/* Estados de máquina: colorean la silueta completa */
.scada-svg-machine.scada-state-fault .machine-shell { fill: #fde7e5; stroke: #c73b32; }
.scada-svg-machine.scada-state-fault .machine-secondary { fill: #f8d4d0; }
.scada-svg-machine.scada-state-fault .machine-core { fill: #d64b42; stroke: #a52620; }
.scada-svg-machine.scada-state-fault .machine-arm,
.scada-svg-machine.scada-state-fault .machine-gripper { stroke: #d64b42; }
.scada-svg-machine.scada-state-fault .machine-cutout { stroke: #a52620; }
.scada-svg-machine.scada-state-fault .scada-svg-state-bg { fill: #c73b32; }

.scada-svg-machine.scada-state-maintenance .machine-shell { fill: #fff0db; stroke: #d9821b; }
.scada-svg-machine.scada-state-maintenance .machine-secondary { fill: #ffe2ba; }
.scada-svg-machine.scada-state-maintenance .machine-core { fill: #e8932c; stroke: #ad6511; }
.scada-svg-machine.scada-state-maintenance .machine-arm,
.scada-svg-machine.scada-state-maintenance .machine-gripper { stroke: #e8932c; }
.scada-svg-machine.scada-state-maintenance .machine-cutout { stroke: #ad6511; }
.scada-svg-machine.scada-state-maintenance .scada-svg-state-bg { fill: #d9821b; }

.scada-svg-machine.scada-state-waiting .machine-shell { fill: #fff7cf; stroke: #c9a20f; }
.scada-svg-machine.scada-state-waiting .machine-secondary { fill: #fceca7; }
.scada-svg-machine.scada-state-waiting .machine-core { fill: #d9b726; stroke: #977c00; }
.scada-svg-machine.scada-state-waiting .machine-arm,
.scada-svg-machine.scada-state-waiting .machine-gripper { stroke: #d9b726; }
.scada-svg-machine.scada-state-waiting .machine-cutout { stroke: #977c00; }
.scada-svg-machine.scada-state-waiting .scada-svg-state-bg { fill: #c39a00; }

.scada-svg-machine.scada-state-offline .machine-shell,
.scada-svg-machine.scada-state-unlinked .machine-shell { fill: #eceff1; stroke: #7b8791; }
.scada-svg-machine.scada-state-offline .machine-secondary,
.scada-svg-machine.scada-state-unlinked .machine-secondary { fill: #e1e5e8; }
.scada-svg-machine.scada-state-offline .machine-core,
.scada-svg-machine.scada-state-unlinked .machine-core { fill: #8f9aa3; stroke: #68727a; }
.scada-svg-machine.scada-state-offline .machine-arm,
.scada-svg-machine.scada-state-offline .machine-gripper,
.scada-svg-machine.scada-state-unlinked .machine-arm,
.scada-svg-machine.scada-state-unlinked .machine-gripper { stroke: #8f9aa3; }
.scada-svg-machine.scada-state-offline .scada-svg-state-bg,
.scada-svg-machine.scada-state-unlinked .scada-svg-state-bg { fill: #707b84; }

/* Override manual: borde azul sin ocultar el estado real seleccionado */
.scada-svg-machine.manual .machine-shell {
    stroke: #2563eb;
    stroke-width: 6;
    stroke-dasharray: 12 7;
}
.scada-svg-machine.manual .scada-svg-mode-bg {
    fill: #2563eb;
    stroke: #2563eb;
}
.scada-svg-machine.manual .scada-svg-mode-text { fill: #fff; }

.scada-svg-legend text {
    fill: #62707e;
    font-size: 11px;
    font-weight: 700;
}
.scada-svg-legend .legend-ok { fill: #2f9c60; }
.scada-svg-legend .legend-fault { fill: #c73b32; }
.scada-svg-legend .legend-maintenance { fill: #d9821b; }
.scada-svg-legend .legend-waiting { fill: #c39a00; }

@media (hover:hover) and (pointer:fine) {
    .scada-svg-machine:hover .machine-shell {
        filter: brightness(.96);
        stroke-width: 6;
    }
}

@media (max-width: 700px) {
    .scada-svg { min-width: 1050px; }
}


/* V1.5.4 - Equipos auxiliares STORTI */
.scada-aux-title{margin:18px 0 9px;color:#6d625f;font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.05em}
.scada-aux-grid{display:grid;grid-template-columns:repeat(2,minmax(250px,1fr));gap:10px;margin-bottom:14px}
.scada-aux-card{display:flex;align-items:center;gap:14px;padding:12px;border:2px solid #6ab78a;border-radius:12px;background:#f7fcf9;color:#2d2927;text-decoration:none!important;min-width:0}
.scada-aux-graphic{width:150px;min-width:150px;height:80px;display:flex;align-items:center}
.scada-aux-graphic svg{width:100%;height:auto;display:block}
.scada-aux-card .aux-shell{fill:#e4f5eb;stroke:#2f8f59;stroke-width:3}
.scada-aux-card .aux-core{fill:#45ad6d;stroke:#2c7a4d;stroke-width:2}
.scada-aux-card .aux-detail{fill:none;stroke:#65727e;stroke-width:4;stroke-linecap:round}
.scada-aux-card .aux-wheel{fill:#dfe5ea;stroke:#65727e;stroke-width:2}
.scada-aux-card.scada-state-fault{border-color:#d65a50;background:#fff7f6}.scada-aux-card.scada-state-fault .aux-shell{fill:#fde7e5;stroke:#c73b32}.scada-aux-card.scada-state-fault .aux-core{fill:#d64b42}
.scada-aux-card.scada-state-maintenance{border-color:#e7a256;background:#fff9f3}.scada-aux-card.scada-state-maintenance .aux-shell{fill:#fff0db;stroke:#d9821b}.scada-aux-card.scada-state-maintenance .aux-core{fill:#e8932c}
.scada-aux-card.scada-state-waiting{border-color:#d8bb3f;background:#fffdf4}.scada-aux-card.scada-state-waiting .aux-shell{fill:#fff7cf;stroke:#c9a20f}.scada-aux-card.scada-state-waiting .aux-core{fill:#d9b726}
.scada-aux-card.scada-state-offline,.scada-aux-card.scada-state-unlinked{border-color:#9aa3aa;background:#f4f5f6}.scada-aux-card.scada-state-offline .aux-shell,.scada-aux-card.scada-state-unlinked .aux-shell{fill:#eceff1;stroke:#7b8791}.scada-aux-card.scada-state-offline .aux-core,.scada-aux-card.scada-state-unlinked .aux-core{fill:#aab3ba}
.scada-aux-info{display:flex;flex:1;min-width:0;flex-direction:column;gap:4px}.scada-aux-topline{display:flex;align-items:center;justify-content:space-between;gap:8px}.scada-aux-topline strong{font-size:15px}.scada-aux-info>span{font-size:11px;color:#706663}.scada-aux-state{margin-top:4px;font-size:10px;color:#31784d}
.scada-aux-card.scada-state-fault .scada-aux-state{color:#a32922}.scada-aux-card.scada-state-maintenance .scada-aux-state{color:#a45912}.scada-aux-card.scada-state-waiting .scada-aux-state{color:#846700}.scada-aux-card.scada-state-offline .scada-aux-state,.scada-aux-card.scada-state-unlinked .scada-aux-state{color:#666}
@media(max-width:720px){.scada-aux-grid{grid-template-columns:1fr}.scada-aux-graphic{width:120px;min-width:120px}}


/* V1.5.5 - SCADA con imagen realista */
.scada-photo-wrap{width:100%;overflow-x:auto;margin:12px 0 16px;padding-bottom:4px;-webkit-overflow-scrolling:touch}
.scada-photo-stage{position:relative;min-width:1180px;aspect-ratio:3/1;overflow:hidden;border-radius:14px;border:1px solid #22384b;background:#0b1d2d}
.scada-photo-image{display:block;width:100%;height:100%;object-fit:cover}
.scada-photo-hotspot{position:absolute;top:16%;height:67%;display:block;border:3px solid rgba(55,185,100,.82);background:rgba(40,170,82,.08);border-radius:9px;box-sizing:border-box;text-decoration:none!important;transition:background .15s ease,border-color .15s ease,box-shadow .15s ease}
.scada-photo-hotspot:hover{background:rgba(40,170,82,.16);box-shadow:0 0 0 3px rgba(255,255,255,.20) inset}
.scada-photo-hotspot .scada-photo-badge{position:absolute;left:8px;bottom:8px;display:inline-flex;align-items:center;gap:6px;padding:5px 8px;border-radius:999px;background:rgba(8,29,45,.88);color:#fff;font-size:10px;font-weight:900;letter-spacing:.02em;white-space:nowrap;box-shadow:0 2px 8px rgba(0,0,0,.25)}
.scada-photo-hotspot .scada-photo-badge i{width:9px;height:9px;border-radius:50%;display:inline-block;background:#39b866}
.scada-photo-hotspot.scada-state-fault{border-color:#ef4d49;background:rgba(239,77,73,.13)}
.scada-photo-hotspot.scada-state-fault .scada-photo-badge i{background:#ef4d49}
.scada-photo-hotspot.scada-state-maintenance{border-color:#f59d2a;background:rgba(245,157,42,.13)}
.scada-photo-hotspot.scada-state-maintenance .scada-photo-badge i{background:#f59d2a}
.scada-photo-hotspot.scada-state-waiting{border-color:#f0c432;background:rgba(240,196,50,.13)}
.scada-photo-hotspot.scada-state-waiting .scada-photo-badge i{background:#f0c432}
.scada-photo-hotspot.scada-state-offline,.scada-photo-hotspot.scada-state-unlinked{border-color:#98a7b5;background:rgba(120,137,151,.16)}
.scada-photo-hotspot.scada-state-offline .scada-photo-badge i,.scada-photo-hotspot.scada-state-unlinked .scada-photo-badge i{background:#98a7b5}
.scada-photo-hotspot.manual{border-color:#3ca7ff;border-style:dashed;box-shadow:0 0 0 2px rgba(60,167,255,.25)}
.scada-photo-qgs{left:1.0%;width:10.3%}
.scada-photo-kuka{left:11.1%;width:13.0%}
.scada-photo-dat2008{left:24.7%;width:10.7%}
.scada-photo-gsi170{left:35.5%;width:9.2%}
.scada-photo-gsp{left:44.8%;width:8.6%}
.scada-photo-gsi270{left:53.5%;width:9.3%}
.scada-photo-gsr{left:62.9%;width:9.1%}
.scada-photo-fresadoras{left:72.2%;width:11.1%}
.scada-photo-sellos{left:83.4%;width:8.7%}
.scada-photo-gst{left:92.2%;width:7.3%}
@media(max-width:700px){.scada-photo-stage{min-width:1040px}.scada-photo-hotspot .scada-photo-badge{font-size:9px;padding:4px 6px}}

.push-settings-card{display:flex;justify-content:space-between;gap:18px;align-items:center;margin:0 0 16px;padding:15px 16px;border:1px solid #e5d9d6;border-radius:10px;background:#fff}
.push-settings-card h3{margin:0 0 4px}.push-settings-card p{margin:0 0 4px;color:#6e625f}
.push-settings-actions{display:flex;flex-wrap:wrap;gap:8px}.webpush-quick{margin-top:6px}
@media(max-width:760px){.push-settings-card{align-items:stretch;flex-direction:column}.push-settings-actions,.push-settings-actions button{width:100%}}

.webpush-active{
    opacity:1!important;
    cursor:default!important;
}

.diag-card{background:#fff;border:1px solid #e4d9d6;border-radius:12px;padding:8px 16px;margin-bottom:16px}
.diag-row{display:flex;justify-content:space-between;gap:20px;padding:12px 0;border-bottom:1px solid #eee}
.diag-row:last-child{border-bottom:none}
.diag-row span{text-align:right;word-break:break-word}
.diag-ok{font-weight:700;color:#198754}
.diag-bad{font-weight:700;color:#c62828}
.diag-small{font-size:.82rem;max-width:60%}
.diag-actions{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.diag-status{margin-top:8px;font-weight:600}
@media(max-width:760px){.diag-row{flex-direction:column;gap:4px}.diag-row span{text-align:left}.diag-small{max-width:100%}.diag-actions>*{width:100%}}


/* ============================================================
   SCADA STORTI V1.7.0 · planta real + palets animados
   ============================================================ */
.scada-real-wrap{
    width:100%;
    overflow-x:auto;
    margin:12px 0 10px;
    padding-bottom:4px;
    -webkit-overflow-scrolling:touch;
}
.scada-real-stage{
    position:relative;
    min-width:1320px;
    aspect-ratio:5.05/1;
    overflow:hidden;
    border-radius:15px;
    border:1px solid #193246;
    background:#101c25;
    box-shadow:0 12px 32px rgba(17,32,46,.18);
}
.scada-real-image{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}
.scada-real-stage:after{
    content:"";
    position:absolute;
    inset:0;
    pointer-events:none;
    background:linear-gradient(180deg,rgba(4,20,32,.03),rgba(4,20,32,.00) 55%,rgba(4,20,32,.13));
}
.scada-live-pill{
    position:absolute;
    z-index:8;
    top:12px;
    right:14px;
    display:flex;
    align-items:center;
    gap:7px;
    padding:7px 10px;
    border-radius:999px;
    background:rgba(7,28,43,.88);
    color:#fff;
    font-size:11px;
    font-weight:900;
    letter-spacing:.03em;
    box-shadow:0 3px 14px rgba(0,0,0,.25);
}
.scada-live-dot{
    width:10px;height:10px;border-radius:50%;
    background:#30d158;
    box-shadow:0 0 0 4px rgba(48,209,88,.14);
}
.scada-real-hotspot{
    position:absolute;
    z-index:6;
    top:20%;
    height:69%;
    border:2px solid rgba(44,190,96,.66);
    background:rgba(24,168,78,.045);
    border-radius:8px;
    text-decoration:none!important;
    box-sizing:border-box;
    transition:.16s ease;
}
.scada-real-hotspot:hover{
    border-width:3px;
    background:rgba(35,190,93,.12);
    box-shadow:inset 0 0 0 2px rgba(255,255,255,.22),0 0 20px rgba(21,113,64,.20);
}
.scada-real-state{
    position:absolute;
    left:50%;
    transform:translateX(-50%);
    bottom:7px;
    min-width:max-content;
    display:grid;
    grid-template-columns:10px auto;
    grid-template-areas:"dot name" "dot state";
    column-gap:6px;
    align-items:center;
    padding:5px 9px;
    border-radius:8px;
    background:rgba(7,28,43,.90);
    color:#fff;
    box-shadow:0 2px 9px rgba(0,0,0,.30);
}
.scada-real-state i{
    grid-area:dot;
    width:10px;height:10px;border-radius:50%;
    background:#35c96c;
}
.scada-real-state b{
    grid-area:name;
    font-size:10px;
    line-height:1.05;
    letter-spacing:.02em;
}
.scada-real-state em{
    grid-area:state;
    font-size:8px;
    line-height:1.05;
    font-style:normal;
    opacity:.82;
}
.scada-real-hotspot.scada-state-fault{
    border-color:#f0524d;background:rgba(240,82,77,.10)
}
.scada-real-hotspot.scada-state-fault .scada-real-state i{background:#f0524d}
.scada-real-hotspot.scada-state-maintenance{
    border-color:#f39a27;background:rgba(243,154,39,.10)
}
.scada-real-hotspot.scada-state-maintenance .scada-real-state i{background:#f39a27}
.scada-real-hotspot.scada-state-waiting{
    border-color:#eec52d;background:rgba(238,197,45,.10)
}
.scada-real-hotspot.scada-state-waiting .scada-real-state i{background:#eec52d}
.scada-real-hotspot.scada-state-offline,
.scada-real-hotspot.scada-state-unlinked{
    border-color:#94a1ad;background:rgba(90,106,120,.11)
}
.scada-real-hotspot.scada-state-offline .scada-real-state i,
.scada-real-hotspot.scada-state-unlinked .scada-real-state i{background:#94a1ad}
.scada-real-hotspot.manual{
    border-color:#3ba6ff;
    border-style:dashed;
    box-shadow:inset 0 0 0 1px rgba(59,166,255,.25);
}

/* Hotspots aligned to the approved 8-step line */
.scada-real-qgs{left:2.3%;width:9.0%}
.scada-real-kuka{left:13.0%;width:9.0%}
.scada-real-dat2008{left:23.0%;width:11.5%}
.scada-real-gsi170{left:35.5%;width:9.0%}
.scada-real-gsp{left:45.4%;width:8.6%}
.scada-real-gsi270{left:54.5%;width:10.0%}
.scada-real-fresadoras{left:65.4%;width:15.0%}
.scada-real-tunel_pintado{left:81.6%;width:16.0%}

.scada-process-title{
    margin:8px 2px 16px;
    padding:9px 12px;
    border-radius:9px;
    background:#f3f7fa;
    border:1px solid #dce5eb;
    color:#425466;
    font-size:12px;
    text-align:center;
}
.scada-process-title span{color:#b51f17;font-weight:900;margin:0 3px}

/* Wooden pallet animation */
.scada-pallet-track{
    position:absolute;
    z-index:5;
    inset:0;
    pointer-events:none;
}
.scada-moving-pallet{
    position:absolute;
    left:3.5%;
    top:72%;
    width:31px;
    height:19px;
    transform:perspective(90px) rotateX(55deg) rotateZ(-2deg);
    filter:drop-shadow(0 4px 3px rgba(0,0,0,.34));
    animation:cmc-pallet-run 19s linear infinite;
}
.scada-moving-pallet span{
    position:absolute;
    left:0;
    width:31px;
    height:3px;
    border-radius:1px;
    background:#d49a51;
    border:1px solid rgba(92,54,18,.55);
    box-sizing:border-box;
}
.scada-moving-pallet span:nth-child(1){top:0}
.scada-moving-pallet span:nth-child(2){top:4px}
.scada-moving-pallet span:nth-child(3){top:8px}
.scada-moving-pallet span:nth-child(4){top:12px}
.scada-moving-pallet span:nth-child(5){top:16px}
.scada-moving-pallet:before,
.scada-moving-pallet:after{
    content:"";
    position:absolute;
    top:1px;
    height:17px;
    width:3px;
    background:#a76a2c;
    border-radius:1px;
}
.scada-moving-pallet:before{left:5px}
.scada-moving-pallet:after{right:5px}
.scada-moving-pallet.pallet-b{animation-delay:-6.3s}
.scada-moving-pallet.pallet-c{animation-delay:-12.6s}

@keyframes cmc-pallet-run{
    0%   {left:3.5%; top:72%; opacity:0}
    2%   {opacity:1}
    82%  {left:78%; top:72%; opacity:1}
    92%  {left:88%; top:74%; opacity:1}
    98%  {left:96%; top:78%; opacity:1}
    100% {left:98%; top:78%; opacity:0}
}

@media(max-width:700px){
    .scada-real-stage{min-width:1180px}
    .scada-real-state{padding:4px 6px}
    .scada-real-state b{font-size:9px}
    .scada-real-state em{font-size:7px}
}
@media(prefers-reduced-motion:reduce){
    .scada-moving-pallet{animation:none;display:none}
}


/* ============================================================
   SCADA STORTI V1.7.1 · imagen preferida, tamaño responsive
   ============================================================ */
.scada-v171-wrap{
    width:100%;
    display:flex;
    justify-content:center;
    margin:12px 0 10px;
}
.scada-v171-stage{
    position:relative;
    width:min(100%,1200px);
    aspect-ratio:1798/319;
    overflow:hidden;
    border-radius:14px;
    border:1px solid #d8e1e8;
    background:#eef3f6;
    box-shadow:0 8px 24px rgba(32,52,70,.12);
}
.scada-v171-image{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    display:block;
    object-fit:cover;
}

/* Clickable machine areas. Keep them transparent so the image stays clean. */
.scada-v171-hit{
    position:absolute;
    top:16%;
    height:69%;
    z-index:5;
    text-decoration:none!important;
    border-radius:8px;
}
.scada-v171-hit:hover{
    outline:2px solid rgba(22,123,190,.55);
    background:rgba(28,127,190,.04);
}

/* position of the 8 machines in the preferred image */
.scada-v171-qgs{left:3.2%;width:10.0%}
.scada-v171-kuka{left:15.0%;width:10.0%}
.scada-v171-dat2008{left:27.5%;width:11.0%}
.scada-v171-gsi170{left:40.5%;width:10.0%}
.scada-v171-gsp{left:52.0%;width:9.0%}
.scada-v171-gsi270{left:62.5%;width:10.5%}
.scada-v171-fresadoras{left:74.0%;width:11.0%}
.scada-v171-tunel_pintado{left:86.0%;width:11.0%}

.scada-v171-badge{
    position:absolute;
    left:50%;
    bottom:5px;
    transform:translateX(-50%);
    min-width:max-content;
    display:grid;
    grid-template-columns:9px auto;
    grid-template-areas:"dot name" "dot state";
    column-gap:5px;
    align-items:center;
    padding:4px 7px;
    border-radius:8px;
    background:rgba(9,29,43,.90);
    color:white;
    box-shadow:0 2px 8px rgba(0,0,0,.25);
}
.scada-v171-badge i{
    grid-area:dot;
    width:9px;height:9px;border-radius:50%;
    background:#2fc769;
}
.scada-v171-badge b{
    grid-area:name;
    font-size:9px;
    line-height:1.05;
}
.scada-v171-badge em{
    grid-area:state;
    font-size:7px;
    line-height:1.05;
    font-style:normal;
    opacity:.82;
}
.scada-v171-badge.scada-state-fault i{background:#e74b44}
.scada-v171-badge.scada-state-maintenance i{background:#ef9427}
.scada-v171-badge.scada-state-waiting i{background:#e2ba22}
.scada-v171-badge.scada-state-offline i,
.scada-v171-badge.scada-state-unlinked i{background:#8995a0}
.scada-v171-badge.manual{outline:2px dashed #369cff}

/* small visible pallet animation across the main conveyor */
.scada-v171-pallet{
    position:absolute;
    z-index:6;
    left:8%;
    top:69%;
    width:22px;
    height:14px;
    pointer-events:none;
    animation:scada-v171-run 16s linear infinite;
    filter:drop-shadow(0 2px 2px rgba(0,0,0,.35));
}
.scada-v171-pallet span{
    position:absolute;
    left:0;
    width:22px;
    height:3px;
    border-radius:1px;
    background:#d19856;
    border:1px solid rgba(88,50,18,.45);
}
.scada-v171-pallet span:nth-child(1){top:0}
.scada-v171-pallet span:nth-child(2){top:4px}
.scada-v171-pallet span:nth-child(3){top:8px}
.scada-v171-pallet span:nth-child(4){top:12px}
.scada-v171-pallet.pallet-2{animation-delay:-8s}
@keyframes scada-v171-run{
    0%{left:8%;top:69%;opacity:0}
    4%{opacity:1}
    82%{left:82%;top:69%;opacity:1}
    92%{left:91%;top:72%;opacity:1}
    100%{left:96%;top:76%;opacity:0}
}
@media(max-width:800px){
    .scada-v171-stage{width:100%}
    .scada-v171-badge{padding:3px 5px}
    .scada-v171-badge b{font-size:7px}
    .scada-v171-badge em{display:none}
    .scada-v171-badge i{width:7px;height:7px}
}
@media(prefers-reduced-motion:reduce){
    .scada-v171-pallet{display:none}
}


/* ============================================================
   V1.7.3 · estados SCADA 100% dinámicos
   La imagen ya no decide el color de estado.
   ============================================================ */
.scada-v171-hit{
    box-sizing:border-box;
    border:3px solid transparent;
    transition:background .18s ease,border-color .18s ease,box-shadow .18s ease;
}
.scada-v171-hit.scada-zone-state-ok{
    border-color:rgba(36,190,92,.72);
    background:rgba(36,190,92,.035);
}
.scada-v171-hit.scada-zone-state-fault{
    border-color:rgba(226,55,48,.98);
    background:rgba(226,55,48,.16);
    box-shadow:inset 0 0 0 2px rgba(255,255,255,.30),0 0 18px rgba(226,55,48,.30);
}
.scada-v171-hit.scada-zone-state-maintenance{
    border-color:rgba(240,143,31,.98);
    background:rgba(240,143,31,.14);
}
.scada-v171-hit.scada-zone-state-waiting{
    border-color:rgba(226,184,28,.98);
    background:rgba(226,184,28,.14);
}
.scada-v171-hit.scada-zone-state-offline,
.scada-v171-hit.scada-zone-state-unlinked{
    border-color:rgba(119,133,145,.92);
    background:rgba(119,133,145,.15);
}
.scada-v171-hit.manual{
    outline:3px dashed #268ff0;
    outline-offset:-6px;
}

/* El indicador dinámico se hace más visible que cualquier elemento del fondo. */
.scada-v171-badge{
    bottom:8px;
    padding:6px 9px;
    border:2px solid rgba(255,255,255,.72);
    z-index:10;
}
.scada-v171-badge i{
    width:12px;
    height:12px;
}
.scada-v171-badge b{font-size:10px}
.scada-v171-badge em{font-size:8px}

.scada-v171-badge.scada-state-ok{background:rgba(17,112,55,.94)}
.scada-v171-badge.scada-state-fault{background:rgba(167,26,22,.96)}
.scada-v171-badge.scada-state-maintenance{background:rgba(173,92,10,.96)}
.scada-v171-badge.scada-state-waiting{background:rgba(145,112,7,.96)}
.scada-v171-badge.scada-state-offline,
.scada-v171-badge.scada-state-unlinked{background:rgba(66,78,88,.96)}

.scada-v171-badge.scada-state-ok i{background:#35d06f}
.scada-v171-badge.scada-state-fault i{background:#ff4d48}
.scada-v171-badge.scada-state-maintenance i{background:#ff9d2e}
.scada-v171-badge.scada-state-waiting i{background:#ffd431}
.scada-v171-badge.scada-state-offline i,
.scada-v171-badge.scada-state-unlinked i{background:#a3adb5}


/* ============================================================
   V1.8.0 · Preventivo recomendado por fabricante
   ============================================================ */
.manufacturer-head p{max-width:850px}
.manufacturer-filter{
    margin:0 0 16px;
    padding:12px 14px;
    background:#fff;
    border:1px solid #e1e7eb;
    border-radius:10px;
}
.manufacturer-filter form{display:flex;gap:10px;align-items:center}
.manufacturer-filter select{min-width:260px}
.manufacturer-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(310px,1fr));
    gap:14px;
}
.manufacturer-card{
    background:#fff;
    border:1px solid #dfe6ea;
    border-radius:12px;
    padding:15px;
    box-shadow:0 4px 14px rgba(26,48,66,.06);
}
.manufacturer-card-top{
    display:flex;
    justify-content:space-between;
    gap:10px;
    align-items:center;
    margin-bottom:8px;
}
.manufacturer-badge{
    background:#163d59;
    color:#fff;
    font-weight:800;
    font-size:11px;
    border-radius:999px;
    padding:5px 8px;
}
.manufacturer-frequency{
    background:#eef5f8;
    color:#21485f;
    font-weight:800;
    font-size:11px;
    border-radius:999px;
    padding:5px 8px;
}
.manufacturer-card h3{margin:0 0 5px;font-size:18px}
.manufacturer-machine{
    color:#a5231b;
    font-weight:800;
    margin-bottom:12px;
}
.manufacturer-row{
    display:grid;
    grid-template-columns:95px 1fr;
    gap:8px;
    padding:7px 0;
    border-top:1px solid #edf0f2;
    font-size:13px;
}
.manufacturer-row b{color:#405362}
.manufacturer-source{
    margin-top:10px;
    padding:8px 10px;
    border-radius:8px;
    background:#f7f4ed;
    color:#5d5549;
    font-size:12px;
}
.manufacturer-actions{margin-top:12px}
.manufacturer-pending{font-size:12px;color:#7a6c61}
.manufacturer-confirm{
    max-width:760px;
    background:#fff;
    border:1px solid #dfe6ea;
    border-radius:12px;
    padding:20px;
}
@media(max-width:700px){
    .manufacturer-grid{grid-template-columns:1fr}
    .manufacturer-row{grid-template-columns:1fr}
    .manufacturer-filter form{align-items:stretch;flex-direction:column}
    .manufacturer-filter select{min-width:0;width:100%}
}


/* ============================================================
   V1.8.4 · Preventivo fabricante en formato lista
   ============================================================ */
.manufacturer-filter-list{
    margin-bottom:12px;
}
.manufacturer-list-wrap{
    width:100%;
    overflow-x:auto;
    background:#fff;
    border:1px solid #dfe6ea;
    border-radius:12px;
    box-shadow:0 4px 14px rgba(26,48,66,.05);
}
.manufacturer-list-table{
    width:100%;
    min-width:1180px;
    border-collapse:collapse;
    font-size:13px;
}
.manufacturer-list-table thead th{
    position:sticky;
    top:0;
    z-index:2;
    text-align:left;
    background:#15384f;
    color:#fff;
    padding:10px 9px;
    white-space:nowrap;
}
.manufacturer-list-table tbody td{
    padding:9px;
    vertical-align:top;
    border-bottom:1px solid #e8edf0;
    line-height:1.35;
}
.manufacturer-list-table tbody tr:nth-child(even){
    background:#f8fafb;
}
.manufacturer-list-table tbody tr:hover{
    background:#eef5f8;
}
.manufacturer-frequency-list{
    display:inline-block;
    white-space:nowrap;
}
.manufacturer-task-title{
    color:#1b2e3c;
}
.manufacturer-source-cell span,
.manufacturer-source-cell small{
    display:block;
    white-space:nowrap;
}
.manufacturer-source-cell small{
    color:#687985;
    margin-top:2px;
}
.manufacturer-action-cell{
    white-space:nowrap;
}
.compact-btn{
    display:inline-block;
    padding:6px 10px!important;
    min-height:auto!important;
    font-size:12px!important;
}
.manufacturer-no-frequency{
    display:inline-block;
    padding:5px 8px;
    border-radius:7px;
    background:#fff3cd;
    color:#755b00;
    font-size:11px;
    font-weight:700;
}
.manufacturer-notes{
    margin-top:5px;
    font-size:12px;
}
.manufacturer-notes summary{
    cursor:pointer;
    color:#9c241b;
    font-weight:700;
}
.manufacturer-notes div{
    margin-top:5px;
    color:#56636d;
}
@media(max-width:700px){
    .manufacturer-list-table{font-size:12px}
}

.manufacturer-shift{
    display:block;
    font-weight:700;
    color:#17384e;
}
.manufacturer-list-table td small{
    display:block;
    color:#6c7982;
    margin-top:2px;
}

/* V1.8.8 · filtro fecha + fuentes enlazadas */
.manufacturer-date-filter{margin:0 0 14px;background:#fff;border:1px solid #dfe6ea;border-radius:10px;padding:10px 12px}
.manufacturer-date-filter form{display:flex;align-items:flex-end;gap:8px;flex-wrap:wrap}
.manufacturer-date-filter label{display:block;font-size:12px;font-weight:700;margin-bottom:4px}
.manufacturer-date-filter input[type="date"]{min-height:36px;padding:6px 9px;border:1px solid #cbd5dc;border-radius:7px;background:#fff}
.manufacturer-source-links{display:flex;gap:5px;flex-wrap:wrap;margin-top:6px}
.source-page-btn{display:inline-block;padding:4px 7px;border:1px solid #9db1bf;border-radius:6px;background:#f5f9fb;color:#163c55;font-size:11px;font-weight:700;text-decoration:none;white-space:nowrap}
.source-page-btn:hover{background:#e7f0f5}


/* V1.8.12 · Visor interno de páginas del manual para PWA/iPhone */
.manual-viewer-topbar{
    position:sticky;
    top:0;
    z-index:30;
    display:flex;
    align-items:center;
    gap:14px;
    flex-wrap:wrap;
    padding:10px 12px;
    margin:-4px 0 12px;
    background:rgba(255,255,255,.97);
    border:1px solid #dbe3e8;
    border-radius:10px;
    box-shadow:0 3px 12px rgba(0,0,0,.08);
}
.manual-back-btn{
    display:inline-flex;
    align-items:center;
    min-height:40px;
    padding:8px 12px;
    border-radius:8px;
    background:#17384f;
    color:#fff!important;
    text-decoration:none;
    font-weight:700;
    white-space:nowrap;
}
.manual-viewer-title{
    display:flex;
    flex-direction:column;
    gap:2px;
}
.manual-viewer-title span{
    font-size:12px;
    color:#667782;
}
.manual-page-shell{
    width:100%;
    overflow:auto;
    background:#edf1f3;
    border:1px solid #d5dde2;
    border-radius:10px;
    padding:10px;
    text-align:center;
}
.manual-page-shell img{
    display:block;
    width:auto;
    max-width:100%;
    height:auto;
    margin:0 auto;
    background:#fff;
    box-shadow:0 2px 10px rgba(0,0,0,.12);
}
.manual-viewer-bottom{
    padding:14px 0 4px;
}
@media(max-width:700px){
    .manual-viewer-topbar{
        position:sticky;
        top:0;
        align-items:stretch;
    }
    .manual-back-btn{
        width:100%;
        justify-content:center;
        font-size:14px;
    }
    .manual-viewer-title{
        width:100%;
        text-align:center;
    }
    .manual-page-shell{
        padding:4px;
        border-radius:6px;
    }
}

/* V1.8.13 · cierre preventivo simplificado */
.preventive-task-summary{
    margin:0 0 14px;
    padding:12px 14px;
    border:1px solid #d9e2e7;
    border-radius:10px;
    background:#f7fafb;
}
.preventive-task-summary > div{
    margin-top:4px;
}


/* V1.8.15 · liberaciones por fecha + histórico de órdenes */
.manufacturer-released-badge,
.manufacturer-closed-badge{
    display:inline-block;
    padding:5px 8px;
    border-radius:7px;
    font-size:11px;
    font-weight:800;
}
.manufacturer-released-badge{
    background:#fff3cd;
    color:#705600;
}
.manufacturer-closed-badge{
    background:#dff2e4;
    color:#176b33;
}
.closed-orders-summary{
    margin-bottom:12px;
    padding:10px 12px;
    background:#fff;
    border:1px solid #dfe6ea;
    border-radius:10px;
}
.closed-orders-table{
    width:100%;
    border-collapse:collapse;
    min-width:1050px;
}
.closed-orders-table th{
    text-align:left;
    padding:10px;
    background:#e9f0f5;
    color:#7d2115;
}
.closed-orders-table td{
    padding:10px;
    border-bottom:1px solid #e3e9ed;
    vertical-align:top;
}
.closed-orders-table tbody tr:nth-child(even){
    background:#f8fafb;
}
.closed-type{
    display:inline-block;
    padding:4px 7px;
    border-radius:6px;
    font-size:11px;
    font-weight:800;
}
.preventive-type{
    background:#e4f3e7;
    color:#1e6d36;
}
.corrective-type{
    background:#fde8e6;
    color:#8b2419;
}


/* ============================================================
   V1.8.17 · Easter egg SCADA: carretilla + pila de palets
   ============================================================ */
.scada-forklift-easter{
    position:absolute;
    left:-14%;
    bottom:3%;
    width:120px;
    height:64px;
    z-index:4;
    pointer-events:none;
    opacity:0;
}
.scada-forklift-scene{
    position:relative;
    width:120px;
    height:64px;
}
.scada-forklift{
    position:absolute;
    left:0;
    bottom:3px;
    width:62px;
    height:43px;
}
.forklift-body{
    position:absolute;
    left:7px;
    bottom:9px;
    width:43px;
    height:22px;
    border-radius:6px 9px 4px 4px;
    background:#e4a523;
    border:2px solid #815b0d;
    box-shadow:inset 0 -4px 0 rgba(0,0,0,.10);
}
.forklift-cabin{
    position:absolute;
    left:25px;
    bottom:28px;
    width:25px;
    height:21px;
    border:3px solid #6f5114;
    border-bottom:0;
    border-radius:4px 4px 0 0;
}
.forklift-window{
    position:absolute;
    inset:3px 3px 1px;
    border-radius:2px;
    background:rgba(170,220,239,.82);
}
.forklift-mast{
    position:absolute;
    right:4px;
    bottom:8px;
    width:5px;
    height:43px;
    border-radius:2px;
    background:#4f565b;
    box-shadow:5px 0 0 #626a70;
}
.forklift-forks{
    position:absolute;
    right:-25px;
    bottom:8px;
    width:31px;
    height:4px;
    background:#596167;
    border-radius:1px;
    box-shadow:0 6px 0 #596167;
}
.forklift-wheel{
    position:absolute;
    bottom:1px;
    width:14px;
    height:14px;
    border-radius:50%;
    background:#24282b;
    border:2px solid #626a70;
}
.forklift-wheel::after{
    content:"";
    position:absolute;
    inset:4px;
    border-radius:50%;
    background:#aeb6bc;
}
.forklift-wheel.wheel-a{left:10px}
.forklift-wheel.wheel-b{left:42px}

.forklift-pallet-stack{
    position:absolute;
    left:72px;
    bottom:12px;
    width:39px;
    height:47px;
    transform-origin:8px 43px;
}
.forklift-pallet-stack span{
    position:absolute;
    left:0;
    width:38px;
    height:7px;
    border-radius:2px;
    background:#bd7b3d;
    border:1px solid #75451f;
    box-shadow:
        inset 0 -2px 0 rgba(84,44,15,.18),
        0 1px 1px rgba(0,0,0,.14);
}
.forklift-pallet-stack span:nth-child(1){bottom:0}
.forklift-pallet-stack span:nth-child(2){bottom:9px}
.forklift-pallet-stack span:nth-child(3){bottom:18px}
.forklift-pallet-stack span:nth-child(4){bottom:27px}
.forklift-pallet-stack span:nth-child(5){bottom:36px}

.forklift-clonk{
    position:absolute;
    left:78px;
    top:-5px;
    padding:3px 6px;
    border-radius:8px;
    background:#fff7c8;
    border:2px solid #6d4d10;
    color:#7d2318;
    font-size:12px;
    font-weight:900;
    letter-spacing:.4px;
    transform:rotate(-8deg) scale(.3);
    opacity:0;
    box-shadow:0 2px 6px rgba(0,0,0,.20);
}

/* Entrada de la carretilla, pequeño golpe y salida. */
.scada-forklift-easter.run{
    opacity:1;
    animation:forklift-drive-scene 10s linear both;
}
.scada-forklift-easter.run .scada-forklift{
    animation:forklift-bump 10s linear both;
}
.scada-forklift-easter.run .forklift-wheel{
    animation:forklift-wheel-spin .55s linear infinite;
}
.scada-forklift-easter.run .forklift-pallet-stack{
    animation:pallet-stack-fall 10s ease-in-out both;
}
.scada-forklift-easter.run .forklift-clonk{
    animation:forklift-clonk-pop 10s linear both;
}

@keyframes forklift-drive-scene{
    0%   {left:-14%; opacity:0}
    4%   {opacity:1}
    50%  {left:62%; opacity:1}
    64%  {left:63%; opacity:1}
    83%  {left:78%; opacity:1}
    96%  {left:106%; opacity:1}
    100% {left:112%; opacity:0}
}
@keyframes forklift-bump{
    0%,48%   {transform:translateX(0) rotate(0)}
    50%      {transform:translateX(5px) rotate(-2deg)}
    52%      {transform:translateX(-2px) rotate(2deg)}
    55%,100% {transform:translateX(0) rotate(0)}
}
@keyframes pallet-stack-fall{
    0%,48% {transform:translate(0,0) rotate(0deg)}
    52%    {transform:translate(4px,-1px) rotate(8deg)}
    58%    {transform:translate(18px,11px) rotate(42deg)}
    64%    {transform:translate(31px,25px) rotate(78deg)}
    100%   {transform:translate(31px,25px) rotate(78deg)}
}
@keyframes forklift-clonk-pop{
    0%,53% {opacity:0; transform:rotate(-8deg) scale(.3)}
    56%    {opacity:1; transform:rotate(-8deg) scale(1.18)}
    61%    {opacity:1; transform:rotate(-8deg) scale(1)}
    70%,100% {opacity:0; transform:rotate(-8deg) scale(.9)}
}
@keyframes forklift-wheel-spin{
    from{transform:rotate(0deg)}
    to{transform:rotate(360deg)}
}

@media(max-width:800px){
    .scada-forklift-easter{
        transform:scale(.72);
        transform-origin:left bottom;
        bottom:1%;
    }
}
@media(prefers-reduced-motion:reduce){
    .scada-forklift-easter{display:none!important}
}

/* V1.8.20: estilos SCADA críticos inline en dashboard.html para evitar caché antigua. */

/* V1.8.21 · Stock bajo */
.low-stock-summary{
    margin:0 0 14px;
    padding:12px 14px;
    background:#fff;
    border:1px solid #dfe6ea;
    border-radius:10px;
}
.low-stock-table{
    width:100%;
    border-collapse:collapse;
    background:#fff;
}
.low-stock-table th{
    text-align:left;
    padding:12px 14px;
    background:#e9f0f5;
    color:#7d2115;
    border-bottom:1px solid #d7e0e6;
}
.low-stock-table td{
    padding:12px 14px;
    border-bottom:1px solid #e7ecef;
    vertical-align:top;
}
.low-stock-table tbody tr:nth-child(even){
    background:#f8fafb;
}

/* V1.8.22 · Preventivo fabricante multi-máquina */
.manufacturer-unscheduled-head{margin:24px 0 10px;padding:14px 16px;background:#fff7df;border:1px solid #efd48a;border-radius:10px}.manufacturer-unscheduled-head h2{margin:0 0 5px;color:#7d2115}.manufacturer-unscheduled-head p{margin:0}.manufacturer-date-filter select{min-width:220px}


/* V1.8.24 · Prueba de cierre rápido de preventivos */
.quick-close-toolbar{
    display:flex;
    align-items:center;
    gap:14px;
    flex-wrap:wrap;
    margin:0 0 14px;
    padding:12px 14px;
    background:#fff;
    border:1px solid #dfe6ea;
    border-radius:10px;
}
.quick-select-all{
    display:flex;
    align-items:center;
    gap:8px;
}
.quick-select-all input,
.quick-task-check{
    width:20px;
    height:20px;
    cursor:pointer;
}
.quick-main-btn{
    font-weight:700;
}
.quick-counter{
    margin-left:auto;
    font-weight:700;
    color:#52616b;
}
.quick-close-table{
    width:100%;
    border-collapse:collapse;
    background:#fff;
}
.quick-close-table th{
    text-align:left;
    padding:11px 12px;
    background:#e9f0f5;
    border-bottom:1px solid #d6e0e6;
}
.quick-close-table td{
    padding:11px 12px;
    border-bottom:1px solid #e7ecef;
    vertical-align:middle;
}
.quick-close-table tbody tr:hover{
    background:#f8fafb;
}
.quick-check-col{
    width:34px;
    text-align:center !important;
}
.quick-actions{
    min-width:250px;
    white-space:nowrap;
}
.quick-ok-btn{
    background:#2f9d61;
    color:#fff !important;
    border:0;
    margin-right:5px;
}
.quick-detail-btn{
    background:#eef2f5;
    color:#34424b !important;
    border:1px solid #d8e0e5;
}
.quick-description{
    font-size:.88rem;
    margin-top:4px;
    color:#697780;
}
.quick-empty{
    padding:18px;
    background:#fff;
    border:1px solid #dfe6ea;
    border-radius:10px;
}
.quick-detail-section{
    margin-top:24px;
}
@media(max-width:800px){
    .quick-close-table{
        font-size:.88rem;
    }
    .quick-actions{
        min-width:160px;
        white-space:normal;
    }
    .quick-actions .btn{
        display:block;
        width:100%;
        margin:3px 0;
    }
    .quick-counter{
        width:100%;
        margin-left:0;
    }
}

/* V1.8.25 · Acciones dentro de Preventivo */
.preventive-head-actions{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}


/* V1.8.30 · Mantener posición al liberar preventivo fabricante */
.manufacturer-schedule-row{
    scroll-margin-top: 90px;
}
.manufacturer-return-highlight{
    outline: 3px solid rgba(44, 120, 170, .35);
    outline-offset: -3px;
}


/* V1.8.31 · Mejoras operativas */
.manufacturer-bulk-toolbar{
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
    margin:10px 0 12px;
    padding:10px 12px;
    background:#fff;
    border:1px solid #dfe6ea;
    border-radius:10px;
}
.bulk-release-check{
    width:34px;
    text-align:center;
}
.bulk-release-check input{
    width:18px;
    height:18px;
}
.my-day-summary{
    display:grid;
    grid-template-columns:repeat(2,minmax(160px,240px));
    gap:12px;
    margin:10px 0 22px;
}
.my-day-summary>div{
    background:#fff;
    border:1px solid #dfe6ea;
    border-radius:10px;
    padding:14px;
}
.my-day-summary strong{
    display:block;
    font-size:1.7rem;
}
.my-day-summary span{
    color:#61717a;
}
.preventive-incident-action{
    margin:12px 0 18px;
}
.preventive-spare-search{
    width:100%;
    max-width:720px;
    margin:8px 0 14px;
    padding:10px 12px;
}
@media(max-width:700px){
    .my-day-summary{grid-template-columns:1fr;}
}


/* V1.8.32 · Tareas pendientes */
.pending-task-priority-urgent{font-weight:800;}


/* V1.8.35 - interfaz más compacta */
.dashboard-section-title{margin:12px 0 7px;font-size:12px}
.dashboard-kpi-grid{gap:8px;grid-template-columns:repeat(6,minmax(120px,1fr))}
.dashboard-kpi,.dashboard-month-card{padding:9px 11px;border-radius:8px}
.dashboard-kpi span,.dashboard-month-card span{font-size:11px;margin-bottom:3px}
.dashboard-kpi strong,.dashboard-month-card strong{font-size:21px}
.dashboard-month-grid{gap:8px;grid-template-columns:repeat(4,minmax(150px,1fr))}
.dashboard-two-columns{gap:10px;margin-top:10px}
.dashboard-panel{padding:11px;margin-top:10px}
.technician-shift-dashboard{margin-bottom:10px!important}
.users-summary-grid{display:grid;grid-template-columns:repeat(2,minmax(160px,240px));gap:10px;margin:8px 0 14px}
.users-summary-card{background:#fff;border:1px solid #dce5ee;border-radius:8px;padding:10px 13px;display:flex;gap:10px;align-items:baseline}
.users-summary-card strong{font-size:22px;color:#7A271A}.users-summary-card span{font-size:12px;color:#607385}
.users-section{margin-top:16px}.users-section h2{margin-bottom:2px}
.ot-compact-filters{display:grid!important;grid-template-columns:repeat(4,minmax(135px,1fr)) repeat(2,minmax(130px,.8fr)) auto auto;gap:7px!important;align-items:end}
.ot-compact-filters select,.ot-compact-filters input{min-width:0}
.ot-time-manual-note{margin:10px 0 14px;padding:9px 12px}
@media(max-width:1200px){.dashboard-kpi-grid{grid-template-columns:repeat(3,1fr)}.ot-compact-filters{grid-template-columns:repeat(3,1fr)}}
@media(max-width:760px){.dashboard-kpi-grid,.dashboard-month-grid{grid-template-columns:repeat(2,1fr)}.dashboard-kpi,.dashboard-month-card{padding:8px}.dashboard-kpi strong,.dashboard-month-card strong{font-size:19px}.users-summary-grid,.ot-compact-filters{grid-template-columns:1fr}}


/* V1.8.36 - análisis inteligente */
.ai-ot-action{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:0 0 14px}
.ai-ot-action span{font-size:13px;color:#667085}
.ai-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:0 0 14px}
.ai-kpi{background:#fff;border:1px solid #e4e7ec;border-radius:10px;padding:12px 14px}
.ai-kpi span{display:block;font-size:12px;color:#667085}
.ai-kpi strong{display:block;font-size:24px;margin-top:3px}
.ai-card-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-bottom:18px}
.ai-priority-card{display:block;background:#fff;border:1px solid #e4e7ec;border-left:5px solid #98a2b3;border-radius:9px;padding:12px;text-decoration:none;color:inherit}
.ai-priority-card:hover{box-shadow:0 3px 10px rgba(16,24,40,.10)}
.ai-priority-alta{border-left-color:#b42318}
.ai-priority-media{border-left-color:#dc6803}
.ai-level{display:inline-block;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:#475467;margin-bottom:5px}
.ai-level-inline{margin:0}
.ai-priority-card strong{display:block}
.ai-priority-card p{margin:5px 0 0;color:#667085;font-size:13px}
.ai-chip{display:inline-block;background:#f2f4f7;border:1px solid #e4e7ec;border-radius:14px;padding:3px 7px;margin:2px;font-size:12px}
.ai-case-card{background:#fff;border:1px solid #e4e7ec;border-radius:10px;padding:14px;margin:0 0 12px}
.ai-case-head{display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid #eaecf0;padding-bottom:9px;margin-bottom:10px}
.ai-case-head span{margin-left:8px;color:#667085;font-size:12px}
.ai-score{font-weight:700;background:#ecfdf3;border:1px solid #abefc6;border-radius:16px;padding:5px 10px;white-space:nowrap}
.ai-case-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.ai-case-grid>div{background:#f9fafb;border-radius:7px;padding:9px}
.ai-case-grid span{display:block;font-size:11px;text-transform:uppercase;color:#667085;font-weight:700}
.ai-case-grid p{margin:4px 0 0;white-space:pre-wrap}
.ai-spares{margin-top:10px}
@media(max-width:900px){
  .ai-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .ai-card-grid,.ai-case-grid{grid-template-columns:1fr}
}


/* V1.8.37 - rediseño visual con iconos */
:root{
  --cmc-card:#ffffff;
  --cmc-border:#e4e7ec;
  --cmc-text:#1d2939;
  --cmc-muted:#667085;
  --cmc-soft:#f8fafc;
  --cmc-red:#b42318;
  --cmc-orange:#dc6803;
  --cmc-green:#067647;
  --cmc-blue:#175cd3;
}
.nav-icon-link{
  display:flex !important;
  align-items:center;
  gap:9px;
}
.nav-icon-link>span{
  width:22px;
  text-align:center;
  flex:0 0 22px;
  filter:saturate(.9);
}
.dashboard-compact{
  border-radius:14px;
  overflow:hidden;
}
.dashboard-kpi{
  border-radius:12px !important;
  border:1px solid var(--cmc-border) !important;
  box-shadow:0 1px 2px rgba(16,24,40,.04);
  transition:.18s ease;
}
.dashboard-kpi:hover{
  transform:translateY(-1px);
  box-shadow:0 5px 14px rgba(16,24,40,.08);
}
.dashboard-kpi span{
  font-weight:600;
}
.section-heading{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:22px;
}
.ai-summary-grid-pro{
  grid-template-columns:repeat(4,minmax(0,1fr));
}
.ai-kpi{
  position:relative;
  min-height:96px;
  border-radius:13px !important;
  box-shadow:0 2px 8px rgba(16,24,40,.05);
}
.ai-kpi-icon{
  position:absolute;
  right:12px;
  top:10px;
  font-size:24px;
  opacity:.9;
}
.ai-kpi strong{
  font-size:28px !important;
  letter-spacing:-.02em;
}
.ai-priority-card{
  border-radius:12px !important;
  box-shadow:0 2px 7px rgba(16,24,40,.04);
}
.ai-priority-card:hover{
  transform:translateY(-1px);
}
.status-pill{
  display:inline-flex;
  align-items:center;
  min-height:24px;
  padding:3px 8px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  line-height:1.2;
  border:1px solid transparent;
  white-space:nowrap;
}
.status-pendiente{background:#f2f4f7;color:#344054;border-color:#e4e7ec}
.status-asignada{background:#eff8ff;color:#175cd3;border-color:#b2ddff}
.status-en_curso{background:#fffaeb;color:#b54708;border-color:#fedf89}
.status-esperando_repuesto{background:#fff4ed;color:#b93815;border-color:#f9dbaf}
.status-esperando_produccion{background:#f4f3ff;color:#5925dc;border-color:#d9d6fe}
.status-terminada{background:#ecfdf3;color:#067647;border-color:#abefc6}
.status-cancelada{background:#fef3f2;color:#b42318;border-color:#fecdca}
.priority-baja{background:#f2f4f7;color:#475467;border-color:#e4e7ec}
.priority-media{background:#eff8ff;color:#175cd3;border-color:#b2ddff}
.priority-alta{background:#fffaeb;color:#b54708;border-color:#fedf89}
.priority-critica{background:#fef3f2;color:#b42318;border-color:#fecdca}
.table-wrap table{
  border-collapse:separate;
  border-spacing:0;
}
.table-wrap thead th{
  position:sticky;
  top:0;
  z-index:2;
  background:#f8fafc;
  border-bottom:1px solid var(--cmc-border);
}
.table-wrap tbody tr{
  transition:background .12s ease;
}
.table-wrap tbody tr:hover{
  background:#fcfcfd;
}
.form-card,.info-card,.assignment-summary,.close-info-banner{
  border-radius:12px !important;
}
.primary-btn,.secondary-btn,.danger-btn,.delete-btn{
  border-radius:9px !important;
  font-weight:700;
}
@media(max-width:900px){
  .ai-summary-grid-pro{grid-template-columns:repeat(2,minmax(0,1fr))}
  .dashboard-kpi{min-height:72px}
}
@media(max-width:560px){
  .ai-summary-grid-pro{grid-template-columns:1fr 1fr}
  .nav-icon-link>span{width:20px;flex-basis:20px}
}


/* V1.8.39 - Órdenes unificadas */
.compact-page-header{
  margin-bottom:10px !important;
}
.order-scope-tabs{
  display:flex;
  gap:4px;
  margin:0 0 10px;
  border-bottom:1px solid #e4e7ec;
}
.order-scope-tabs a{
  text-decoration:none;
  color:#667085;
  font-weight:700;
  font-size:13px;
  padding:8px 14px;
  border-radius:8px 8px 0 0;
}
.order-scope-tabs a:hover{
  background:#f8fafc;
}
.order-scope-tabs a.active{
  color:#b42318;
  background:#fff;
  border:1px solid #e4e7ec;
  border-bottom-color:#fff;
  margin-bottom:-1px;
}
.unified-order-filters{
  display:grid !important;
  grid-template-columns:repeat(4,minmax(130px,1fr)) 140px 140px auto auto;
  gap:7px !important;
  align-items:center;
  margin-bottom:8px !important;
}
.unified-order-filters select,
.unified-order-filters input{
  min-width:0;
  height:36px;
}
.filter-clear{
  font-size:12px;
  text-decoration:none;
  color:#667085;
  text-align:center;
}
.order-type-legend{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin:5px 0 9px;
}
.order-type-pill{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:4px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  white-space:nowrap;
  border:1px solid transparent;
}
.type-preventiva{
  background:#ecfdf3;
  color:#067647;
  border-color:#abefc6;
}
.type-averia{
  background:#fef3f2;
  color:#b42318;
  border-color:#fecdca;
}
.type-planificada{
  background:#eff8ff;
  color:#175cd3;
  border-color:#b2ddff;
}
.status-vencida{
  background:#fef3f2;
  color:#b42318;
  border-color:#fecdca;
}
.status-programada{
  background:#f2f4f7;
  color:#475467;
  border-color:#e4e7ec;
}
.unified-orders-table-wrap{
  max-height:calc(100vh - 275px);
  overflow:auto;
}
.unified-orders-table{
  font-size:12.5px;
}
.unified-orders-table th{
  padding:8px 9px !important;
}
.unified-orders-table td{
  padding:7px 9px !important;
  vertical-align:middle;
}
.order-row-preventiva td:first-child{
  border-left:3px solid #12b76a;
}
.order-row-averia td:first-child{
  border-left:3px solid #f04438;
}
.order-row-planificada td:first-child{
  border-left:3px solid #2e90fa;
}
.compact-open-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:4px 9px;
  border:1px solid #d0d5dd;
  border-radius:7px;
  text-decoration:none;
  font-weight:700;
  background:#fff;
}
@media(max-width:1150px){
  .unified-order-filters{
    grid-template-columns:repeat(3,minmax(140px,1fr));
  }
}
@media(max-width:700px){
  .unified-order-filters{
    grid-template-columns:1fr 1fr;
  }
  .unified-orders-table-wrap{
    max-height:none;
  }
}


/* V1.8.43 - Selector Nueva orden */
.new-order-menu{
  position:relative;
}
.new-order-menu>summary{
  list-style:none;
  cursor:pointer;
  user-select:none;
}
.new-order-menu>summary::-webkit-details-marker{
  display:none;
}
.new-order-menu-panel{
  position:absolute;
  right:0;
  top:calc(100% + 7px);
  z-index:40;
  width:360px;
  padding:7px;
  border:1px solid #e4e7ec;
  border-radius:12px;
  background:#fff;
  box-shadow:0 12px 28px rgba(16,24,40,.14);
}
.new-order-choice{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:11px;
  text-decoration:none;
  color:#344054;
  border-radius:9px;
}
.new-order-choice:hover{
  background:#f8fafc;
}
.new-order-choice-icon{
  display:flex;
  width:34px;
  height:34px;
  align-items:center;
  justify-content:center;
  border-radius:9px;
  background:#f2f4f7;
  font-size:18px;
  flex:0 0 34px;
}
.new-order-choice strong,
.new-order-choice small{
  display:block;
}
.new-order-choice small{
  margin-top:2px;
  color:#667085;
  line-height:1.3;
}
.choice-breakdown .new-order-choice-icon{
  background:#fef3f2;
}
.choice-planned .new-order-choice-icon{
  background:#eff8ff;
}
@media(max-width:600px){
  .new-order-menu-panel{
    position:fixed;
    left:12px;
    right:12px;
    top:auto;
    width:auto;
  }
}


/* V1.8.45 - buscador de repuestos y validación cierre */
.inline-form-error{
  margin:0 0 12px;
  padding:10px 12px;
  border:1px solid #fecdca;
  border-radius:9px;
  background:#fef3f2;
  color:#b42318;
  font-weight:700;
  font-size:13px;
}
.spare-search-box{
  margin:0 0 10px;
  padding:10px 12px;
  border:1px solid #e4e7ec;
  border-radius:10px;
  background:#f8fafc;
}
.spare-search-box label{
  display:block;
  margin-bottom:5px;
}
.spare-search-box input{
  width:100%;
  min-height:38px;
  padding:7px 10px;
  border:1px solid #d0d5dd;
  border-radius:8px;
  background:#fff;
}
.spare-search-box small{
  display:block;
  margin-top:4px;
  color:#667085;
}


/* V1.8.49 - cierre OT inline sin recargas */
.inline-close-panel{
  margin:8px 0 14px;
  border:2px solid #b2ddff;
  border-radius:12px;
  background:#f5fbff;
  padding:14px;
}
.inline-close-head h2{margin:0 0 3px}
.inline-close-head p{margin:0 0 12px;color:#475467}
.compact-spare-question{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:12px;
}
.inline-spares-panel{
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid #d1e9ff;
}
.inline-spare-add-grid{
  display:grid;
  grid-template-columns:minmax(260px,1fr) 110px auto;
  gap:10px;
  align-items:end;
  margin-bottom:10px;
}
.inline-spare-add-grid label{display:block;margin-bottom:4px;font-weight:700}
.inline-spare-add-grid select,
.inline-spare-add-grid input{width:100%;min-height:38px}
.inline-spare-add-action{padding-bottom:1px}
.inline-used-spares-wrap{margin-top:8px}
.inline-form-success{
  margin:0 0 10px;
  padding:9px 11px;
  border:1px solid #abefc6;
  border-radius:8px;
  background:#ecfdf3;
  color:#067647;
  font-weight:700;
}
.link-button{
  border:0;background:transparent;color:#b42318;cursor:pointer;font-weight:700;padding:3px 5px;
}
.ot-field{margin:0 0 14px}
.ot-field label{font-weight:700}
.ot-field .helptext{display:block;color:#667085;font-size:12px;margin-top:3px}
.field-error{display:block;color:#b42318;font-size:12px;font-weight:700}
@media(max-width:750px){
  .inline-spare-add-grid{grid-template-columns:1fr}
}


/* V1.8.50 - cierre separado y estable */
.ot-main-actions{display:flex;gap:10px;flex-wrap:wrap}
.dedicated-close-panel{
  margin-top:16px;
  padding:16px;
  border:2px solid #b2ddff;
  border-radius:12px;
  background:#f5fbff;
}
.final-close-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
