:root {
    --reducto-bg: #f7f8fb;
    --reducto-panel: #ffffff;
    --reducto-border: #e7ebf3;
    --reducto-text: #0f172a;
    --reducto-muted: #667085;
    --reducto-blue: #2f6bff;
    --reducto-green: #1fb874;
    --reducto-orange: #f97316;
    --reducto-dark: #0b1324;
    --reducto-red: #ef4444;
    --reducto-blue-soft: #eaf1ff;
    --reducto-green-soft: #e7faf2;
    --reducto-orange-soft: #fff2e9;
}
.to-dashboard{background:var(--reducto-bg);min-height:calc(100vh - 90px);padding:24px;color:var(--reducto-text)}
.to-topbar,.to-panel,.to-kpi-card,.to-login-card{background:#fff;border:1px solid var(--reducto-border);border-radius:16px;box-shadow:0 8px 24px rgba(15,23,42,.04)}
.to-topbar{display:flex;justify-content:space-between;align-items:center;gap:24px;padding:22px 24px;margin-bottom:20px}.to-brand-block{display:flex;align-items:center;gap:20px}.to-brand-wordmark{font-size:28px;font-weight:800;letter-spacing:-1px}.to-brand-wordmark.large{font-size:34px}.to-brand-dark{color:var(--reducto-dark)}.to-brand-green{color:var(--reducto-green)}.to-topbar h1,.to-panel h3,.to-login-form-wrap h1{margin:0;font-weight:800}.to-brand-subtitle,.to-topbar p,.to-panel-header p,.to-list-summary,.to-kpi-card .subtext,.to-date-box,.to-login-form-wrap p{color:var(--reducto-muted)}.to-topbar-actions{display:flex;align-items:center;gap:12px}.to-date-box{text-align:right;font-size:13px}
.to-grid-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:16px;margin-bottom:20px}.to-kpi-card{padding:16px}.to-kpi-card .label{font-size:12px;text-transform:uppercase;font-weight:700;letter-spacing:.08em;color:var(--reducto-muted);margin-bottom:8px}.to-kpi-card .value{font-size:40px;font-weight:800;line-height:1;margin-bottom:8px}.to-kpi-card.orange .value{color:var(--reducto-orange)}.to-kpi-card.blue .value{color:var(--reducto-blue)}.to-kpi-card.green .value{color:var(--reducto-green)}.to-kpi-card.dark .value{color:var(--reducto-dark);font-size:34px}
.to-main-grid{display:grid;grid-template-columns:1.4fr 1fr;gap:20px;margin-bottom:20px}.to-side-stack{display:grid;gap:20px}.to-panel{padding:20px;margin-bottom:20px}.to-panel-header{display:flex;justify-content:space-between;align-items:start;gap:18px;margin-bottom:16px}.to-funnel-list,.to-mini-bars,.to-insights-list,.to-quality-cards{display:grid;gap:12px}.to-funnel-row,.to-bar-row{display:grid;grid-template-columns:220px 1fr 90px 120px;gap:12px;align-items:center}.to-bar-row{grid-template-columns:1fr 1.4fr 60px}.to-bar-track{background:#eef2f7;border-radius:999px;height:16px;overflow:hidden}.to-bar-fill{height:100%;border-radius:999px}.to-bar-fill.orange{background:var(--reducto-orange)}.to-bar-fill.blue{background:var(--reducto-blue)}.to-bar-fill.green{background:var(--reducto-green)}.to-bar-fill.red{background:var(--reducto-red)}.to-bar-fill.dark{background:var(--reducto-dark)}
.to-funnel-row .name,.to-bar-row .name{font-weight:600}.to-funnel-row .amount,.to-funnel-row .count,.to-bar-row .count{text-align:right;font-weight:700}.to-chart-wrap{min-height:280px}.to-quality-cards{grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:16px}.to-quality-card{border:1px solid var(--reducto-border);border-radius:14px;padding:16px;background:#fff}.to-quality-card .value{font-size:34px;font-weight:800;color:var(--reducto-orange)}.to-insight{border-top:1px solid var(--reducto-border);padding:14px 0}.to-insight strong{display:block;margin-bottom:6px}
.to-table-scroll{overflow-x:auto}.to-table{width:100%;border-collapse:collapse;font-size:14px}.to-table th,.to-table td{padding:12px 10px;border-bottom:1px solid var(--reducto-border);text-align:left;vertical-align:top}.to-table th{text-transform:uppercase;letter-spacing:.05em;font-size:11px;color:var(--reducto-muted)}.to-toolbar{display:flex;gap:12px;margin-bottom:10px}.to-input,.to-select{border:1px solid var(--reducto-border);border-radius:10px;padding:11px 12px;background:#fff;color:var(--reducto-text)}.to-input{flex:1}.to-pagination{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:12px}.to-pagination .controls{display:flex;gap:10px}
.to-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:10px;padding:10px 14px;font-weight:700;text-decoration:none !important;border:1px solid var(--reducto-border);cursor:pointer}.to-btn-primary{background:var(--reducto-blue);color:#fff !important;border-color:var(--reducto-blue)}.to-btn-light{background:#fff;color:var(--reducto-text) !important}.to-btn-small{padding:6px 10px;font-size:12px}.to-chip{display:inline-block;padding:5px 10px;border-radius:999px;font-size:11px;font-weight:800;margin-right:8px}.to-chip.orange{background:var(--reducto-orange-soft);color:var(--reducto-orange)}.to-chip.blue{background:var(--reducto-blue-soft);color:var(--reducto-blue)}.to-contact-links{display:flex;gap:6px;flex-wrap:wrap}
.to-modal.hidden{display:none}.to-modal{position:fixed;inset:0;z-index:1000}.to-modal-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.5)}.to-modal-card{position:relative;max-width:1100px;width:calc(100% - 40px);margin:40px auto;background:#fff;border-radius:18px;padding:20px;border:1px solid var(--reducto-border)}.to-modal-header{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:12px}
.to-login-page{display:flex;align-items:center;justify-content:center}.to-login-card{width:100%;max-width:460px;padding:32px;margin-top:40px}.to-login-brand{text-align:center;margin-bottom:24px}.to-login-form{display:grid;gap:12px}.to-login-form input{border:1px solid var(--reducto-border);border-radius:12px;padding:14px}.to-login-form button{border:none;border-radius:12px;padding:14px;background:linear-gradient(135deg,var(--reducto-blue),var(--reducto-green));color:#fff;font-weight:800}.to-login-error{background:#fff2f2;color:#b42318;border:1px solid #fecdca;padding:12px;border-radius:12px;margin-bottom:12px}.to-badge{display:inline-block;padding:5px 8px;border-radius:999px;font-size:11px;font-weight:700}.to-badge.green{background:var(--reducto-green-soft);color:var(--reducto-green)}.to-badge.blue{background:var(--reducto-blue-soft);color:var(--reducto-blue)}.to-badge.orange{background:var(--reducto-orange-soft);color:var(--reducto-orange)}.to-badge.gray{background:#eef2f7;color:var(--reducto-muted)}
@media (max-width:1200px){.to-grid-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.to-main-grid{grid-template-columns:1fr}.to-quality-cards{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:768px){.to-dashboard{padding:14px}.to-topbar{flex-direction:column;align-items:start}.to-grid-kpis{grid-template-columns:1fr}.to-toolbar{flex-direction:column}.to-funnel-row,.to-bar-row{grid-template-columns:1fr}.to-quality-cards{grid-template-columns:1fr}}
.to-standalone-body{margin:0;background:var(--reducto-bg);font-family:Arial,Helvetica,sans-serif}.to-logo-img{width:100px;height:auto;display:block}.to-logo-img.large{width:116px}.to-dashboard-error{background:#fff2f2;color:#b42318;border:1px solid #fecdca;padding:12px 14px;border-radius:12px;margin-bottom:16px}.hidden{display:none!important}

/* ============================================================
   V1.2 — refinamiento visual desde Calidad de datos hacia abajo
   ============================================================ */
.to-dashboard,
.to-dashboard * {
    box-sizing: border-box;
}

.to-standalone-body,
.to-dashboard {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.to-quality-panel,
.to-correlation-panel,
.to-action-panel {
    overflow: hidden;
    padding: 24px;
}

.to-section-header {
    margin-bottom: 20px;
}

.to-section-kicker {
    margin-bottom: 5px;
    color: var(--reducto-blue);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.to-quality-panel .to-panel-header h3,
.to-correlation-panel .to-panel-header h3,
.to-action-panel .to-panel-header h3 {
    font-size: 20px;
    line-height: 1.25;
}

.to-quality-panel .to-panel-header p,
.to-correlation-panel .to-panel-header p,
.to-action-panel .to-panel-header p {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.55;
}

/* Calidad de datos */
.to-quality-panel .to-quality-cards {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
}

.to-quality-panel .to-quality-card {
    min-width: 0;
    min-height: 116px;
    padding: 17px 18px;
    border: 1px solid #e3e8f1;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    box-shadow: none;
}

.to-quality-panel .to-quality-card .label {
    color: #475467;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.to-quality-panel .to-quality-card .value {
    margin: 7px 0 5px;
    color: var(--reducto-orange);
    font-size: 30px;
    line-height: 1;
}

.to-quality-panel .to-quality-card .subtext {
    color: var(--reducto-muted);
    font-size: 12px;
    line-height: 1.35;
}

.to-quality-divider {
    height: 1px;
    margin: 22px 0 16px;
    background: var(--reducto-border);
}

.to-quality-panel .to-insights-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.to-quality-panel .to-insight {
    position: relative;
    min-height: 96px;
    padding: 16px 18px 16px 48px;
    border: 1px solid var(--reducto-border);
    border-radius: 12px;
    background: #fbfcfe;
}

.to-quality-panel .to-insight::before {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--reducto-orange-soft);
    color: var(--reducto-orange);
    content: "•";
    font-size: 18px;
    font-weight: 900;
}

.to-quality-panel .to-insight strong {
    margin-bottom: 5px;
    color: var(--reducto-dark);
    font-size: 13px;
    line-height: 1.35;
}

.to-quality-panel .to-insight p {
    margin: 0;
    color: var(--reducto-muted);
    font-size: 12px;
    line-height: 1.55;
}

/* Correlación de estatus */
.to-correlation-panel .to-table-scroll,
.to-action-panel .to-table-scroll {
    border: 1px solid var(--reducto-border);
    border-radius: 12px;
    background: #fff;
}

.to-correlation-panel .to-table,
.to-action-panel .to-table {
    margin: 0;
    font-size: 12px;
}

.to-correlation-panel .to-table thead,
.to-action-panel .to-table thead {
    background: #f8fafc;
}

.to-correlation-panel .to-table th,
.to-action-panel .to-table th {
    padding: 11px 14px;
    border-bottom: 1px solid #dfe5ef;
    color: #667085;
    font-size: 10px;
    font-weight: 800;
}

.to-correlation-panel .to-table td,
.to-action-panel .to-table td {
    padding: 12px 14px;
    color: #344054;
    line-height: 1.45;
}

.to-correlation-panel .to-table tbody tr:last-child td,
.to-action-panel .to-table tbody tr:last-child td {
    border-bottom: 0;
}

.to-correlation-panel .to-table tbody tr:hover,
.to-action-panel .to-table tbody tr:hover {
    background: #fafcff;
}

.to-correlation-panel .to-table th:first-child,
.to-correlation-panel .to-table td:first-child {
    width: 32%;
}

/* Paneles de acción */
.to-action-panel {
    position: relative;
    padding-top: 22px;
}

.to-action-panel::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    content: "";
}

.to-action-orange::before {
    background: linear-gradient(90deg, var(--reducto-orange), #ffb278);
}

.to-action-blue::before {
    background: linear-gradient(90deg, var(--reducto-blue), var(--reducto-green));
}

.to-action-header {
    margin-bottom: 14px;
}

.to-action-panel .to-chip {
    vertical-align: 2px;
}

.to-action-panel .to-toolbar {
    align-items: center;
    margin: 0 0 8px;
    padding: 10px;
    border: 1px solid var(--reducto-border);
    border-radius: 12px;
    background: #f8fafc;
}

.to-action-panel .to-input,
.to-action-panel .to-select {
    height: 38px;
    border-color: #dfe5ef;
    font-size: 12px;
    outline: none;
}

.to-action-panel .to-input:focus,
.to-action-panel .to-select:focus {
    border-color: var(--reducto-blue);
    box-shadow: 0 0 0 3px rgba(47, 107, 255, .10);
}

.to-action-panel .to-list-summary {
    margin: 8px 2px 12px;
    font-size: 11px;
    font-weight: 600;
}

.to-action-panel .to-table-scroll {
    max-height: 540px;
    overflow: auto;
}

.to-action-panel .to-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
}

.to-action-panel .to-table td strong {
    color: var(--reducto-dark);
}

.to-action-panel .to-pagination {
    margin-top: 14px;
    padding-top: 2px;
    color: var(--reducto-muted);
    font-size: 12px;
}

.to-action-panel .to-btn-small {
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 11px;
}

.to-action-panel .to-contact-links {
    flex-wrap: nowrap;
}

@media (max-width: 1100px) {
    .to-quality-panel .to-quality-cards,
    .to-quality-panel .to-insights-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .to-quality-panel,
    .to-correlation-panel,
    .to-action-panel {
        padding: 17px;
    }

    .to-quality-panel .to-quality-cards,
    .to-quality-panel .to-insights-list {
        grid-template-columns: 1fr;
    }

    .to-action-panel .to-toolbar {
        align-items: stretch;
    }
}

/* =====================================================
   v1.3 - Calidad de datos estilo original / vistas / detalle
   ===================================================== */

.to-dashboard,
.to-dashboard * {
    box-sizing: border-box;
}

/* Top modelos: una sola paleta */
#model-list .to-bar-fill {
    background: var(--reducto-blue) !important;
}

/* Calidad de datos inspirada en el artifact original */
.to-dashboard .to-quality-original {
    padding: 26px 28px;
    background: #ffffff;
    border: 1px solid #deddd8;
    border-radius: 14px;
}

.to-dashboard .to-quality-original .quality-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 22px;
}

.to-dashboard .to-quality-original .quality-header h3 {
    margin: 0;
    color: #1c1c1c;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.to-dashboard .to-quality-original .quality-header p {
    margin: 2px 0 0;
    color: #8b877f;
    font-size: 12px;
    line-height: 1.4;
    text-align: right;
}

.to-dashboard .to-quality-original #quality-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 0 0 8px;
}

.to-dashboard .to-quality-original .to-quality-card {
    min-width: 0;
    min-height: 118px;
    padding: 18px;
    background: #f0efec;
    border: 0;
    border-radius: 11px;
    box-shadow: none;
}

.to-dashboard .to-quality-original .to-quality-card .label {
    margin-bottom: 8px;
    color: #5f5b56;
    font-size: 11px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.to-dashboard .to-quality-original .to-quality-card .value {
    margin: 0 0 10px;
    color: #f36a2d;
    font-size: 29px;
    font-weight: 700;
    line-height: 1;
}

.to-dashboard .to-quality-original .to-quality-card .subtext {
    margin: 0;
    color: #67645f;
    font-size: 12px;
    line-height: 1.45;
}

.to-dashboard .to-quality-original #quality-insights {
    display: block;
    margin: 0;
    padding: 0;
}

.to-dashboard .to-quality-original .to-insight {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin: 0;
    padding: 15px 0 17px;
    background: transparent;
    border: 0;
    border-top: 1px solid #dedbd4;
    border-radius: 0;
    min-height: 0;
}

.to-dashboard .to-quality-original .to-insight:first-child {
    border-top: 0;
}

.to-dashboard .to-quality-original .to-insight-number {
    display: inline-flex;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #fff0e9;
    color: #f36a2d;
    font-size: 12px;
    font-weight: 800;
}

.to-dashboard .to-quality-original .to-insight-copy {
    min-width: 0;
    flex: 1;
}

.to-dashboard .to-quality-original .to-insight strong {
    display: block;
    margin: 0 0 5px;
    color: #242321;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.to-dashboard .to-quality-original .to-insight p {
    margin: 0;
    color: #6e6a65;
    font-size: 12px;
    line-height: 1.6;
}

/* Selector de vista */
.to-view-switcher {
    display: inline-flex;
    gap: 4px;
    margin: 0 0 20px;
    padding: 5px;
    border: 1px solid var(--reducto-border);
    border-radius: 12px;
    background: #eef2f7;
}

.to-view-btn {
    padding: 10px 18px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #667085;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.to-view-btn:hover {
    color: var(--reducto-dark);
}

.to-view-btn.active {
    background: #ffffff;
    color: var(--reducto-blue);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

.to-view-section {
    display: none;
}

.to-view-section.active {
    display: block;
}

/* Detalle global */
.to-global-detail-panel {
    min-height: 600px;
    padding: 22px;
}

.to-global-detail-panel .to-toolbar {
    margin-bottom: 10px;
}

.to-global-detail-panel .to-table-scroll {
    max-height: 680px;
    overflow: auto;
    border: 1px solid var(--reducto-border);
    border-radius: 12px;
    background: #fff;
}

.to-global-detail-panel .to-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
}

.to-global-detail-row {
    cursor: pointer;
    transition: background .15s ease;
}

.to-global-detail-row:hover {
    background: #f4f7ff !important;
}

.to-global-detail-row td:first-child {
    color: var(--reducto-blue);
}

/* Modal individual de Trade-In */
.to-request-modal-card {
    max-width: 860px;
    max-height: calc(100vh - 70px);
    overflow: auto;
}

.to-request-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.to-request-field {
    padding: 14px;
    border: 1px solid var(--reducto-border);
    border-radius: 12px;
    background: #f8fafc;
}

.to-request-field span {
    display: block;
    margin-bottom: 5px;
    color: #667085;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.to-request-field strong {
    color: var(--reducto-dark);
    font-size: 14px;
}

.to-request-detail-section {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--reducto-border);
}

.to-request-detail-section h4 {
    margin: 0 0 12px;
    color: var(--reducto-dark);
    font-size: 14px;
    font-weight: 800;
}

.to-request-data-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 16px;
    padding: 7px 0;
}

.to-request-data-row span {
    color: #667085;
    font-size: 12px;
}

.to-request-data-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
    color: #344054;
    font-size: 12px;
}

.to-request-data-row a {
    color: var(--reducto-blue);
    text-decoration: none;
}

.to-request-data-row a:hover {
    text-decoration: underline;
}

@media (max-width: 1000px) {
    .to-dashboard .to-quality-original #quality-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .to-request-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .to-dashboard .to-quality-original {
        padding: 20px 16px;
    }

    .to-dashboard .to-quality-original .quality-header {
        flex-direction: column;
        gap: 6px;
    }

    .to-dashboard .to-quality-original .quality-header p {
        text-align: left;
    }

    .to-dashboard .to-quality-original #quality-cards {
        grid-template-columns: 1fr;
    }

    .to-view-switcher {
        display: flex;
        width: 100%;
    }

    .to-view-btn {
        flex: 1;
    }

    .to-request-summary-grid {
        grid-template-columns: 1fr;
    }

    .to-request-data-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}

/* ======================================
   Detalle global - filtros por tarjetas
   ====================================== */
.to-detail-filter-section {
    margin: 2px 0 16px;
}

.to-detail-filter-label {
    margin: 0 0 8px 2px;
    color: #667085;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.to-detail-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 10px;
}

.to-detail-filter-card {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--reducto-border);
    border-radius: 12px;
    background: #fff;
    color: var(--reducto-dark);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}

.to-detail-filter-card:hover {
    transform: translateY(-1px);
    border-color: #bfd0ff;
    box-shadow: 0 4px 12px rgba(47, 107, 255, .08);
}

.to-detail-filter-card.active {
    border-color: var(--reducto-blue);
    background: var(--reducto-blue-soft);
    box-shadow: 0 0 0 2px rgba(47, 107, 255, .06);
}

.to-detail-filter-title {
    display: block;
    min-height: 30px;
    margin-bottom: 6px;
    color: #667085;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.to-detail-filter-card strong {
    display: block;
    color: var(--reducto-dark);
    font-size: 24px;
    line-height: 1;
}

.to-detail-filter-card.active strong {
    color: var(--reducto-blue);
}

/* ======================================
   Acciones de contacto: icono + texto
   ====================================== */
.to-contact-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: nowrap;
}

.to-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #e1e6ef;
    border-radius: 9px;
    background: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.to-contact-btn i {
    width: 14px;
    font-size: 13px;
    line-height: 1;
    text-align: center;
}

.to-contact-btn:hover {
    transform: translateY(-1px);
}

.to-contact-btn.email {
    color: #475467 !important;
    background: #f8fafc;
}

.to-contact-btn.email:hover {
    color: #101828 !important;
    border-color: #cfd6e2;
    background: #f1f5f9;
    box-shadow: 0 3px 8px rgba(15, 23, 42, .07);
}

.to-contact-btn.phone {
    color: var(--reducto-blue) !important;
    border-color: #cfddff;
    background: #eef4ff;
}

.to-contact-btn.phone:hover {
    color: #1f55dd !important;
    border-color: #aec5ff;
    background: #e2ebff;
    box-shadow: 0 3px 8px rgba(47, 107, 255, .10);
}

.to-contact-btn.whatsapp {
    color: #168b55 !important;
    border-color: #c8ead8;
    background: #eaf8f1;
}

.to-contact-btn.whatsapp:hover {
    color: #087544 !important;
    border-color: #a8ddc2;
    background: #ddf3e8;
    box-shadow: 0 3px 8px rgba(31, 184, 116, .10);
}

.to-action-panel .to-table th:last-child,
.to-action-panel .to-table td:last-child {
    min-width: 230px;
}

@media (max-width: 900px) {
    .to-detail-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

/* =========================================
   Inteligencia operativa
   ========================================= */
.to-intelligence-panel {
    position: relative;
    overflow: hidden;
    padding: 24px !important;
    border-top: 4px solid var(--reducto-blue) !important;
}

.to-intelligence-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 18px;
}

.to-intelligence-header h3 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 800;
    color: var(--reducto-dark);
}

.to-intelligence-header p {
    max-width: 920px;
    margin: 0;
    color: var(--reducto-muted);
    font-size: 12px;
    line-height: 1.55;
}

.to-intelligence-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.to-intelligence-updated {
    color: var(--reducto-muted);
    font-size: 11px;
}

.to-intelligence-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.to-intelligence-loading,
.to-intelligence-empty {
    grid-column: 1 / -1;
    padding: 24px;
    border: 1px dashed var(--reducto-border);
    border-radius: 12px;
    color: var(--reducto-muted);
    text-align: center;
    font-size: 12px;
}

.to-smart-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 290px;
    padding: 18px;
    overflow: hidden;
    border: 1px solid var(--reducto-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(15, 23, 42, .035);
}

.to-smart-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #98a2b3;
}

.to-smart-card.priority-high::before { background: var(--reducto-orange); }
.to-smart-card.priority-medium::before { background: var(--reducto-blue); }
.to-smart-card.priority-low::before { background: var(--reducto-green); }

.to-smart-card-top,
.to-smart-footer,
.to-smart-card-body {
    display: flex;
}

.to-smart-card-top {
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.to-smart-badges,
.to-smart-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.to-smart-priority,
.to-smart-type,
.to-smart-source {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}

.to-smart-priority.high {
    background: var(--reducto-orange-soft);
    color: var(--reducto-orange);
}
.to-smart-priority.medium {
    background: var(--reducto-blue-soft);
    color: var(--reducto-blue);
}
.to-smart-priority.low {
    background: var(--reducto-green-soft);
    color: var(--reducto-green);
}

.to-smart-type {
    background: #f2f4f7;
    color: #475467;
}

.to-smart-source {
    background: #f8fafc;
    color: #98a2b3;
    border: 1px solid #eef2f7;
}

.to-smart-card-body {
    align-items: flex-start;
    gap: 20px;
    flex: 1;
}

.to-smart-copy {
    flex: 1;
    min-width: 0;
}

.to-smart-category {
    margin-bottom: 5px;
    color: var(--reducto-blue);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.to-smart-card h4 {
    margin: 0 0 8px;
    color: var(--reducto-dark);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
}

.to-smart-summary {
    margin: 0 0 12px;
    color: #475467;
    font-size: 12px;
    line-height: 1.55;
}

.to-smart-evidence,
.to-smart-action {
    margin-top: 9px;
    padding: 10px 11px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.5;
}

.to-smart-evidence {
    background: #f8fafc;
    color: #667085;
    border: 1px solid #eef2f7;
}

.to-smart-action {
    background: #f2f7ff;
    color: #344054;
    border: 1px solid #e4edff;
}

.to-smart-evidence span,
.to-smart-action span {
    display: block;
    margin-bottom: 3px;
    color: #344054;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.to-smart-metric {
    flex: 0 0 125px;
    padding: 12px;
    border-radius: 12px;
    background: #f8fafc;
    text-align: right;
}

.to-smart-metric strong {
    display: block;
    color: var(--reducto-dark);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
}

.to-smart-metric span {
    display: block;
    margin-top: 4px;
    color: var(--reducto-muted);
    font-size: 10px;
}

.to-smart-footer {
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--reducto-border);
}

.to-smart-meta span {
    color: #667085;
    font-size: 10px;
}

.to-smart-meta span + span::before {
    content: "•";
    margin-right: 7px;
    color: #d0d5dd;
}

/* SVG propios para botones de contacto: sin dependencia de Font Awesome */
.to-contact-icon {
    display: block;
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    color: currentColor;
}

.to-contact-btn i {
    display: none !important;
}

@media (max-width: 1050px) {
    .to-intelligence-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .to-intelligence-header,
    .to-smart-card-body,
    .to-smart-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .to-intelligence-actions {
        justify-content: space-between;
    }
    .to-smart-metric {
        flex-basis: auto;
        text-align: left;
    }
}

/* ==========================================
   Drill-down Calidad de datos
   ========================================== */
.to-quality-card-clickable {
    position: relative;
    width: 100%;
    text-align: left;
    font: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.to-quality-card-clickable:hover {
    transform: translateY(-2px);
    border-color: #ccd8ef !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .07) !important;
}
.to-quality-card-link {
    margin-top: 9px;
    color: var(--reducto-blue);
    font-size: 11px;
    font-weight: 800;
}
.to-quality-detail-modal-card {
    width: min(1380px, calc(100% - 36px));
    max-width: 1380px;
    max-height: calc(100vh - 56px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.to-quality-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 2px 0 14px;
    padding: 5px;
    border-radius: 12px;
    background: #f2f5fa;
}
.to-quality-tab {
    border: 0;
    border-radius: 9px;
    padding: 9px 13px;
    background: transparent;
    color: #667085;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.to-quality-tab.active {
    background: #fff;
    color: var(--reducto-blue);
    box-shadow: 0 2px 7px rgba(15, 23, 42, .08);
}
.to-quality-detail-toolbar {
    flex: 0 0 auto;
}
.to-quality-detail-table-wrap {
    flex: 1 1 auto;
    max-height: 58vh;
    border: 1px solid var(--reducto-border);
    border-radius: 12px;
}
.to-quality-detail-table-wrap .to-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8fafc;
}
.to-email-stack {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.to-email-stack span {
    display: inline-block;
    max-width: 330px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#tradein-modal { z-index: 1020; }

/* ======================================
   Filtro de periodo - creación semanal
   ====================================== */
.to-weekly-header {
    align-items: flex-end;
    gap: 20px;
}

.to-weekly-filter {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.to-weekly-filter label {
    display: grid;
    gap: 5px;
    margin: 0;
}

.to-weekly-filter label span {
    color: var(--reducto-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.to-date-input {
    min-width: 145px;
    height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--reducto-border);
    border-radius: 9px;
    background: #fff;
    color: var(--reducto-text);
    font-size: 12px;
    outline: none;
}

.to-date-input:focus {
    border-color: var(--reducto-blue);
    box-shadow: 0 0 0 3px rgba(47, 107, 255, .10);
}

.to-weekly-panel .to-chart-wrap {
    min-height: 300px;
}

@media (max-width: 900px) {
    .to-weekly-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .to-weekly-filter {
        justify-content: flex-start;
        width: 100%;
    }
}
