body {
    background: #f4f6f9;
    font-family: Arial, sans-serif;
}

.card {
    border-radius: 18px;
}

.form-control,
.form-select,
.btn {
    border-radius: 10px;
}

.card-body {
    padding: 1rem !important;
    font-size: 0.88rem;
}

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.form-control,
.form-select {
    font-size: 0.82rem;
    min-height: 34px;
    height: 34px;
    padding: 0.25rem 0.55rem;
    border-radius: 0.45rem;
}

textarea.form-control {
    height: auto;
    min-height: 65px;
    font-size: 0.82rem;
    padding: 0.35rem 0.55rem;
}

h2 {
    font-size: 1.4rem;
}

h5 {
    font-size: 0.95rem;
}

.nav-tabs {
    border-bottom: 2px solid #d0d7e2;
}

.nav-tabs .nav-link {
    background-color: #e9eef5;
    color: #495057;
    border: 1px solid #d0d7e2;
    margin-right: 5px;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    background-color: #dce4ef;
    color: #0d6efd;
}

.nav-tabs .nav-link.active {
    background-color: #ffffff;
    color: #0d6efd;
    border-bottom: 2px solid white;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.38rem 0.7rem;
    border-radius: 0.5rem;
}

.btn-primary {
    background-color: #4f8df5;
    border: none;
}

.btn-primary:hover {
    background-color: #3b73e6;
}

.btn-success {
    background-color: #3cbf8f;
    border: none;
    color: #fff;
}

.btn-success:hover {
    background-color: #2da97c;
}

#mensaje {
    font-size: 0.82rem;
}

#resultadoComparendo,
#resultadoPlano {
    font-size: 0.84rem;
}

.observacion-comparendo {
    background-color: #eef6ff;
    border: 1px solid #b8d8ff;
    color: #1f2937;
    font-weight: 500;
    resize: vertical;
}

.observacion-comparendo:focus {
    background-color: #e7f1ff;
    border-color: #4f8df7;
    box-shadow: 0 0 0 0.15rem rgba(79, 141, 247, 0.18);
}

.detalle-comparendo {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 14px;
    padding: 15px;
}

.detalle-comparendo p {
    margin: 6px 0;
}

.alerta {
    margin-top: 15px;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.82rem;
}

.alerta.ok {
    background: #e8f5e9;
    color: #1b5e20;
    border-left: 5px solid #2e7d32;
}

.alerta.error {
    background: #ffebee;
    color: #b71c1c;
    border-left: 5px solid #c62828;
}

/* Mensajes superiores tipo matrícula */
.otsoft-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s ease;
}

.otsoft-alert.visible {
    opacity: 1;
    transform: translateY(0);
}

.otsoft-alert.success {
    background: #e8f5e9;
    color: #1b5e20;
    border-left: 5px solid #2e7d32;
}

.otsoft-alert.warning {
    background: #fff8e1;
    color: #f57f17;
    border-left: 5px solid #f9a825;
}

.otsoft-alert.danger {
    background: #ffebee;
    color: #b71c1c;
    border-left: 5px solid #c62828;
}

.otsoft-alert.info {
    background: #eaf2ff;
    color: #1d4ed8;
    border-left: 5px solid #4f8df5;
}

.otsoft-alert .icono {
    font-size: 18px;
}

/* Responsive */
@media (min-width: 1400px) {
    #registroManual .col-md-4 {
        flex: 0 0 auto;
        width: 25%;
    }
}

@media (max-width: 768px) {
    .card-body {
        padding: 0.8rem !important;
    }

    .nav-tabs .nav-link {
        font-size: 0.78rem;
        padding: 0.4rem 0.6rem;
    }
}

.campo-codigo-infraccion {
    max-width: 120px;
}

.seccion-form {
    background: #f8fbff;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
}

.seccion-form h5 {
    font-size: 0.9rem;
    color: #0d6efd;
    font-weight: 700;
    margin-bottom: 12px;
    border-bottom: 1px solid #dbeafe;
    padding-bottom: 6px;
}

.campo-corto {
    max-width: 130px;
}

.campo-medio {
    max-width: 230px;
}

.seccion-form {
    background: #f8fbff;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
}

.seccion-form h5 {
    font-size: 0.95rem;
    color: #0d6efd;
    font-weight: 700;
    margin-bottom: 12px;
    border-bottom: 1px solid #dbeafe;
    padding-bottom: 6px;
}

.campo-corto {
    max-width: 130px;
}

.total-cantidad-resumen {
    display: inline-block;
    font-size: 1.45rem;
    font-weight: 800;
    margin-left: 8px;
    line-height: 1;
}


.resumen-conductor-card{
    border-radius: 12px;
    padding: 8px 14px;
    min-height: 52px;
}

.resumen-conductor-card:hover{
    transform: translateY(-1px);
}

.resumen-label{
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 1px;
    color: #5b6574;
}

.resumen-valor{
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}


.resumen-pendientes {
    background: linear-gradient(135deg, #eaf2ff 0%, #f8fbff 100%);
}

.resumen-morosos {
    background: linear-gradient(135deg, #fff4db 0%, #fffaf0 100%);
}

.resumen-acuerdos {
    background: linear-gradient(135deg, #eef2f7 0%, #fbfcfe 100%);
}

.resumen-total-seleccionado {
    border-radius: 18px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #d9f7fb 0%, #f0fdff 100%);
    border: 1px solid rgba(14, 165, 233, 0.28);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.resumen-total-label {
    font-size: 1rem;
    font-weight: 800;
    color: #075985;
}

.resumen-total-texto {
    font-size: 0.85rem;
    color: #475569;
}

.resumen-total-valor {
    font-size: 1.45rem;
    font-weight: 800;
    color: #075985;
    white-space: nowrap;
}

/* ===== AJUSTE TABLAS CONSULTA CONDUCTOR ===== */

#resultadoConductor table {
    font-size: 0.88rem;
}

#resultadoConductor table th,
#resultadoConductor table td {
    font-weight: 500;
    vertical-align: middle;
}

#resultadoConductor table thead th {
    font-weight: 700;
}

#resultadoConductor table th:first-child,
#resultadoConductor table td:first-child {
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    text-align: center;
    padding-left: 6px;
    padding-right: 6px;
}

#resultadoConductor table input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    vertical-align: middle;
}

#resultadoConductor .text-danger {
    font-weight: 500 !important;
}

.email-conductor {
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.email-conductor {
    display: block;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
    color: #334155;
}

.editor-formato {
    min-height: 520px;
    max-height: 620px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d8dee9;
    border-radius: 14px;
    padding: 28px;
    font-family: Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #111827;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.editor-formato:focus {
    outline: none;
    border-color: #5b8def;
    box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.15);
}

.editor-toolbar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px;
}

.editor-toolbar .btn {
    margin-right: 4px;
    margin-bottom: 4px;
}

.ck-editor__editable {
    min-height: 520px;
    font-size: 14px;
    line-height: 1.5;
}

.ck.ck-editor {
    border-radius: 14px;
}

.acciones-editor-formatos {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px;
}

.acciones-editor-formatos .btn {
    margin-right: 5px;
    margin-bottom: 5px;
}

.ck-editor__editable {
    min-height: 560px;
    font-size: 14px;
    line-height: 1.5;
}

.editor-html-otsoft {
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.45;
    min-height: 560px;
    border-radius: 14px;
    border: 1px solid #d8dee9;
    background: #ffffff;
}

.acciones-editor-formatos {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px;
}

.acciones-editor-formatos .btn {
    margin-right: 5px;
    margin-bottom: 5px;
}

.vista-previa-formato {
    min-height: 560px;
    max-height: 680px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d8dee9;
    border-radius: 14px;
    padding: 28px;
    font-family: Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #111827;
}

.vista-previa-formato table {
    width: 100%;
    border-collapse: collapse;
}

.vista-previa-formato table td,
.vista-previa-formato table th {
    border: 1px solid #cbd5e1;
    padding: 6px;
}

/* ===== FORMATO COMPLETO CON QUILL ===== */

.editor-quill-documento {
    min-height: 720px;
    background: #ffffff;
}

.editor-quill-documento .ql-editor {
    min-height: 720px;
    font-size: 13px;
    line-height: 1.55;
    font-family: Arial, sans-serif;
    padding: 35px;
}

.editor-quill-documento.ql-container {
    border-radius: 0 0 14px 14px;
    border: 1px solid #d8dee9 !important;
    border-top: 0 !important;
}

.toolbar-quill-otsoft {
    border-radius: 14px 14px 0 0;
    border: 1px solid #d8dee9 !important;
    background: #f8fafc;
}

.vista-previa-formato {
    min-height: 760px;
    max-height: 760px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d8dee9;
    border-radius: 14px;
    padding: 24px;
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.5;
    color: #111827;
}

.vista-previa-formato p {
    margin-bottom: 9px;
    text-align: justify;
}

.vista-previa-formato h3,
.vista-previa-formato h4 {
    font-weight: 700;
    margin-top: 12px;
    margin-bottom: 8px;
}

.vista-previa-formato img {
    max-width: 100%;
}

.acciones-editor-formatos {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px;
}

.acciones-editor-formatos .btn {
    margin-right: 5px;
    margin-bottom: 5px;
}

.formatos-lista .list-group-item {
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid #dbe4f0;
}

.formatos-lista .list-group-item.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: #1d4ed8;
}

.formatos-lista .list-group-item.active small {
    color: #dbeafe !important;
}

.ql-toolbar button,
.ql-toolbar .ql-picker {
    margin-right: 2px;
}

.ql-align-center {
    text-align: center !important;
}

.ql-align-right {
    text-align: right !important;
}

.ql-align-justify {
    text-align: justify !important;
}

/* ===== AJUSTE EDITOR FORMATO COMPLETO ===== */

.acciones-editor-formatos {
    max-height: 120px;
    overflow-y: auto;
}

.btn-xs-variable {
    font-size: 11px;
    padding: 3px 7px;
    line-height: 1.2;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    margin: 2px;
}

.btn-xs-variable:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.editor-quill-documento {
    min-height: 620px;
    max-height: 620px;
    overflow-y: auto;
    background: #ffffff;
}

.editor-quill-documento .ql-editor {
    min-height: 620px;
    font-size: 13px;
    line-height: 1.55;
    font-family: Arial, sans-serif;
    padding: 35px 55px;
}

.editor-quill-documento.ql-container {
    border-radius: 0 0 14px 14px;
    border: 1px solid #d8dee9 !important;
    border-top: 0 !important;
}

.toolbar-quill-otsoft {
    position: sticky;
    top: 0;
    z-index: 5;
    border-radius: 14px 14px 0 0;
    border: 1px solid #d8dee9 !important;
    background: #f8fafc;
}

/* ===== MEJORA VISUAL FORMATOS CONTRAVENCIONES ===== */

.formatos-lista .list-group-item {
    border-radius: 14px;
    margin-bottom: 9px;
    border: 1px solid #dbeafe;
    background: #f8fbff;
    color: #1e3a8a;
    padding: 13px 15px;
    transition: all 0.18s ease;
}

.formatos-lista .list-group-item:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.formatos-lista .list-group-item.active {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #60a5fa;
    color: #1e40af;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
}

.formatos-lista .list-group-item.active .fw-bold {
    color: #1e40af;
}

.btn-vista-documento {
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    color: #075985;
    font-weight: 700;
    border-radius: 10px;
}

.btn-vista-documento:hover {
    background: #bae6fd;
    border-color: #38bdf8;
    color: #075985;
}

.papel-formato-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 12px;
}

.papel-label {
    font-size: 13px;
    font-weight: 800;
    color: #1d4ed8;
    line-height: 1.1;
}

.papel-selector .btn {
    min-width: 78px;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
}

.papel-selector .btn-check:checked + .btn {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.acciones-editor-formatos {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px;
    max-height: 110px;
    overflow-y: auto;
}

.acciones-editor-formatos .fw-bold {
    color: #1d4ed8 !important;
}

.btn-xs-variable {
    font-size: 11px;
    padding: 4px 8px;
    line-height: 1.2;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    margin: 2px;
    font-weight: 600;
}

.btn-xs-variable:hover {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.toolbar-quill-otsoft {
    border-radius: 14px 14px 0 0;
    border: 1px solid #d8dee9 !important;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.editor-quill-documento.ql-container {
    border-radius: 0 0 14px 14px;
    border: 1px solid #d8dee9 !important;
    border-top: 0 !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.editor-quill-documento .ql-editor {
    background: #ffffff;
}

/* ===== RESOLUCIÓN DESDE CONSULTA CONDUCTOR ===== */

.btn-ver-resolucion {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #7dd3fc;
    border-radius: 10px;
    font-weight: 700;
    width: 34px;
    height: 30px;
    padding: 0;
}

.btn-ver-resolucion:hover {
    background: #bae6fd;
    color: #075985;
    border-color: #38bdf8;
}

.btn-ver-resolucion-disabled {
    background: #f1f5f9;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    width: 34px;
    height: 30px;
    padding: 0;
    cursor: not-allowed;
}

.iframe-resolucion-sancion {
    width: 100%;
    height: 76vh;
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    background: #f8fafc;
}

/* ===== DROPDOWN ACCIONES TABLA CONDUCTOR ===== */

#resultadoConductor .card,
#resultadoConductor .card-body,
#resultadoConductor .table-responsive,
#resultadoConductor .tabla-consulta-conductor {
    overflow: visible !important;
}

#resultadoConductor .dropdown-menu {
    z-index: 3000 !important;
    min-width: 230px;
    border-radius: 14px;
    padding: 8px;
    border: 1px solid #dbeafe;
}

#resultadoConductor .dropdown-item {
    font-size: 0.86rem;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 600;
}

#resultadoConductor .dropdown-item:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

/* ===== BOTON ACCIONES MODERNO ===== */

.btn-acciones-tabla {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50% !important;

    background: #ffffff !important;
    border: 1px solid #dbe4f0 !important;

    color: #64748b !important;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);

    transition: all 0.18s ease;
}

.btn-acciones-tabla:hover {
    background: #f8fbff !important;
    border-color: #bfd5f3 !important;
    color: #2563eb !important;

    transform: translateY(-1px);
}

.btn-acciones-tabla i {
    font-size: 13px;
}

.dropdown-toggle-sin-flecha::after {
    display: none !important;
}

/* ===== BOTON ACCIONES OTSoft ===== */

.btn-acciones-tabla {
    width: 34px;
    height: 34px;
    padding: 0;

    border-radius: 50% !important;

    background: #eef5ff !important;
    border: 1px solid #cfe0ff !important;

    color: #3b82f6 !important;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: auto;

    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.08);

    transition: all 0.18s ease;
}

.btn-acciones-tabla:hover {
    background: #dbeafe !important;
    border-color: #93c5fd !important;

    color: #2563eb !important;

    transform: translateY(-1px) scale(1.03);
}

.btn-acciones-tabla i {
    font-size: 12px;
}

/* QUITAR FLECHA */
.dropdown-toggle-sin-flecha::after {
    display: none !important;
}

.btn-acciones-tabla,
#resultadoConductor .btn-acciones-tabla {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: #eef5ff !important;
    border: 1px solid #cfe0ff !important;
    color: #3b82f6 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
}

.btn-acciones-tabla:hover,
#resultadoConductor .btn-acciones-tabla:hover {
    background: #dbeafe !important;
    border-color: #93c5fd !important;
    color: #2563eb !important;
}

.dropdown-toggle-sin-flecha::after {
    display: none !important;
}

/* ===== HISTORIAL CONDUCTOR ===== */

.tabla-historial-conductor {
    font-size: 0.78rem;
}

.tabla-historial-conductor th {
    font-size: 0.76rem;
    font-weight: 700;
    background: #f8fafc;
    color: #334155;
}

.tabla-historial-conductor td {
    font-size: 0.76rem;
    vertical-align: middle;
    padding: 6px 8px;
}

.tabla-historial-conductor .badge {
    font-size: 0.68rem;
}

.acuerdo-pago-card {
    border: 1px solid #dbe4ee !important;
    border-radius: 16px !important;

    background: #f3f6f9 !important;

    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);

    transition: all 0.2s ease;
}

.acuerdo-pago-card .card-body {
    background: #f3f6f9 !important;
    border-radius: 16px;
}

.acuerdo-pago-card:hover {
    border-color: #bfdbfe !important;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.09);
}

.acuerdo-pago-card .small.text-muted {
    font-size: 0.72rem;
}

.acuerdo-pago-card .fw-bold {
    font-size: 0.82rem;
}

/* ===== HISTORIAL CONDUCTOR PRO ===== */

.historial-wrapper {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.historial-bloque {
    background: #f8fafc;
    border: 1px solid #dbe4ee;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.historial-bloque-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

.historial-icono {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef5ff;
    color: #2563eb;
    border-radius: 50%;
    margin-right: 8px;
}

.historial-titulo {
    font-weight: 800;
    color: #0f52ff;
    font-size: 0.92rem;
}

.historial-contador {
    font-size: 0.72rem;
    background: #ffffff;
    border: 1px solid #dbe4ee;
    border-radius: 999px;
    padding: 4px 10px;
    color: #64748b;
}

.tabla-historial-conductor {
    font-size: 0.75rem;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}

.tabla-historial-conductor th {
    background: #f1f5f9;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 7px;
}

.tabla-historial-conductor td {
    font-size: 0.72rem;
    padding: 7px;
    vertical-align: middle;
}

.tabla-historial-conductor .badge {
    font-size: 0.65rem;
}

.fila-log-ok {
    background-color: #f0fdf4;
}

.fila-log-error {
    background-color: #fef2f2;
}

.fila-log-duplicado {
    background-color: #fffbeb;
}

.fila-log-ok:hover,
.fila-log-error:hover,
.fila-log-duplicado:hover {
    filter: brightness(0.98);
}