/* == TITULARES == */

.titulares-page {
    padding: 0;
    width: 100%;
    max-width: 100%;
}

.titulares-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.75rem;
}

.titulares-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.35rem 0;
}

.titulares-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    max-width: 560px;
    margin: 0;
}

.btn-nuevo-titular {
    background-color: #e02020;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.btn-nuevo-titular:hover {
    background-color: #c01a1a;
}

/* Tarjetas resumen */
.titulares-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.titular-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
}

.titular-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.titular-card-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.titular-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a1a;
}

.titular-card-icon {
    font-size: 1.6rem;
    color: #d1d5db;
}

/* Filtros */
.titulares-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.titulares-search {
    position: relative;
    flex: 1;
    max-width: 300px;
    min-width: 0;
}

.titulares-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 0.85rem;
}

.titulares-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #fff;
    box-sizing: border-box;
}

.titulares-search-input:focus {
    outline: none;
    border-color: #9ca3af;
}

.titulares-select {
    padding: 0.5rem 0.85rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #fff;
    cursor: pointer;
    min-height: 40px;
}

/* Ordenacion */
.titulares-sort {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #1a1a1a;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.25rem 0.75rem;
    margin-bottom: 1rem;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.titulares-sort-select {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 0.875rem;
    color: #1a1a1a;
    min-height: 34px;
    padding-right: 1.25rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.titulares-sort-select:focus {
    outline: none;
}

.titulares-sort-chevron {
    color: #9ca3af;
    pointer-events: none;
}

/* Tabla */
.titulares-table-wrapper {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.titulares-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.titulares-table thead tr {
    border-bottom: 1px solid #e5e7eb;
}

.titulares-table th {
    text-align: left;
    padding: 0.85rem 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.titulares-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.titulares-table tbody tr:last-child td {
    border-bottom: none;
}

.titulares-table tbody tr:hover {
    background-color: #f9fafb;
}

.titular-name {
    font-weight: 600;
}

.titular-clickable {
    cursor: pointer;
}

.badge-fisica {
    display: inline-flex;
    align-items: center;
    background-color: #fff;
    color: #3b82f6;
    border: 1px solid #bfdbfe;
    border-radius: 9999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 500;
}

.badge-sociedad {
    display: inline-flex;
    align-items: center;
    background-color: #fff;
    color: #ef4444;
    border: 1px solid #fecaca;
    border-radius: 9999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 500;
}

.vehiculos-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    color: #1a1a1a;
    border-radius: 9999px;
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-acciones {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #6b7280;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.btn-acciones:hover {
    background-color: #f3f4f6;
    color: #1a1a1a;
}

/* == NUEVO TITULAR == */

.nt-page {
    width: 100%;
    max-width: 100%;
}

.nt-header {
    margin-bottom: 1.75rem;
}

.nt-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.3rem 0;
}

.nt-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.nt-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.nt-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1.25rem 0;
    color: #1a1a1a;
}

.nt-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.nt-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nt-field-full {
    width: 100%;
    margin-top: 0.75rem;
}

.nt-label {
    font-size: 0.825rem;
    font-weight: 500;
    color: #374151;
}

.nt-input {
    padding: 0.55rem 0.85rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #fff;
    color: #1a1a1a;
    box-sizing: border-box;
    width: 100%;
    font-family: inherit;
}

.nt-input:focus {
    outline: none;
    border-color: #6b7280;
}

.nt-textarea-sm {
    min-height: 80px;
    resize: vertical;
}

.nt-textarea-lg {
    min-height: 120px;
    resize: vertical;
}

.nt-hint {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-top: 0.2rem;
}

.nt-error {
    font-size: 0.78rem;
    color: #e02020;
    margin-top: 0.15rem;
}

.nt-error-global {
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

.nt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.nt-btn-cancel {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: #374151;
}

.nt-btn-cancel:hover {
    background: #f3f4f6;
}

.nt-btn-save {
    background-color: #e02020;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.nt-btn-save:hover:not(:disabled) {
    background-color: #c01a1a;
}

.nt-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

a.btn-nuevo-titular {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}


/* == NOEVO TITULAR == */

.nt-page { width: 100%; max-width: 100%; }

.nt-header { margin-bottom: 1.75rem; }

.nt-title { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.3rem 0; }

.nt-subtitle { font-size: 0.875rem; color: #6b7280; margin: 0; }

.nt-section { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.5rem; margin-bottom: 1.25rem; }

.nt-section-title { font-size: 1rem; font-weight: 700; margin: 0 0 1.25rem 0; color: #1a1a1a; }

.nt-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.nt-field { display: flex; flex-direction: column; gap: 0.35rem; }

.nt-field-full { width: 100%; margin-top: 0.75rem; }

.nt-label { font-size: 0.825rem; font-weight: 500; color: #374151; }

.nt-input { padding: 0.55rem 0.85rem; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 0.875rem; background: #fff; color: #1a1a1a; box-sizing: border-box; width: 100%; font-family: inherit; }

.nt-input:focus { outline: none; border-color: #6b7280; }

.nt-textarea-sm { min-height: 80px; resize: vertical; }

.nt-textarea-lg { min-height: 120px; resize: vertical; }

.nt-hint { font-size: 0.78rem; color: #9ca3af; margin-top: 0.2rem; }

.nt-error { font-size: 0.78rem; color: #e02020; margin-top: 0.15rem; }

.nt-error-global { background: #fee2e2; color: #b91c1c; border-radius: 8px; padding: 0.65rem 1rem; font-size: 0.875rem; margin-top: 0.75rem; }

.nt-actions { display: flex; justify-content: flex-end; gap: 0.75rem; padding-top: 0.5rem; }

.nt-btn-cancel { background: none; border: 1px solid #e5e7eb; border-radius: 8px; padding: 0.55rem 1.25rem; font-size: 0.9rem; cursor: pointer; color: #374151; }

.nt-btn-cancel:hover { background: #f3f4f6; }

.nt-btn-save { background-color: #e02020; color: #fff; border: none; border-radius: 8px; padding: 0.55rem 1.5rem; font-size: 0.9rem; font-weight: 600; cursor: pointer; }

.nt-btn-save:hover { background-color: #c01a1a; }

.nt-btn-save:disabled { opacity: 0.6; cursor: not-allowed; }

/* == DETALLE TITULAR == */

.dt-page {
    width: 100%;
    max-width: 100%;
}

.dt-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #6b7280;
    text-decoration: none;
    margin-bottom: 0.75rem;
}

.dt-back-link:hover {
    color: #1a1a1a;
}

.dt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.dt-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a1a;
}

.dt-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.dt-btn-editar {
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.5rem 1.1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.dt-btn-editar:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.dt-btn-eliminar {
    background: #fff;
    color: #e02020;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.5rem 1.1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.dt-btn-eliminar:hover {
    background: #fee2e2;
}

.dt-badges {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.75rem;
}

.dt-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.dt-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1.25rem 0;
    color: #1a1a1a;
}

.dt-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.dt-field-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #9ca3af;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.dt-field-value {
    font-size: 0.9rem;
    color: #1a1a1a;
}

.dt-field-value.dt-empty {
    color: #9ca3af;
    font-style: italic;
}

.dt-vehiculo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.85rem 1rem;
}

.dt-vehiculo-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dt-vehiculo-icon {
    color: #6b7280;
    font-size: 1.1rem;
}

.dt-vehiculo-matricula {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.9rem;
}

.dt-vehiculo-modelo {
    font-size: 0.8rem;
    color: #6b7280;
}

.dt-empty-vehiculos {
    color: #9ca3af;
    font-size: 0.875rem;
    font-style: italic;
}

.dt-auditoria {
    font-size: 0.875rem;
    color: #374151;
}

.vehiculos-badge-text {
    font-size: 0.8rem;
    color: #6b7280;
}

@media (max-width: 1200px) {
    .titulares-page {
        overflow-x: hidden;
    }

    .titulares-header {
        display: block;
        margin-bottom: 1rem;
    }

    .titulares-title {
        font-size: 2rem;
        line-height: 1.1;
    }

    .titulares-subtitle {
        max-width: none;
        font-size: 1rem;
        line-height: 1.35;
        margin-bottom: 0.9rem;
    }

    .btn-nuevo-titular {
        display: inline-flex;
        border-radius: 12px;
        min-height: 42px;
        text-decoration: none;
    }

    .titulares-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .titular-card {
        padding: 0.95rem 1rem;
    }

    .titulares-filters {
        gap: 0.55rem;
        margin-bottom: 0.65rem;
    }

    .titulares-search {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .titulares-select {
        flex: 1 1 calc(50% - 0.3rem);
        width: calc(50% - 0.3rem);
        min-width: 0;
    }

    .titulares-sort {
        margin-bottom: 0.8rem;
    }

    .titulares-mobile-list {
        display: block;
    }

    .titulares-table-wrapper {
        display: none;
    }
}

@media (max-width: 576px) {
    .titulares-title {
        font-size: 2.1rem;
    }

    .titular-card-label {
        font-size: 0.66rem;
    }

    .titular-mobile-label,
    .titular-mobile-value {
        font-size: 0.92rem;
    }
}

/* == NUEVO TITULAR == */

.nt-page {
    width: 100%;
    max-width: 100%;
}

.nt-header {
    margin-bottom: 1.75rem;
}

.nt-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.3rem 0;
}

.nt-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.nt-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.nt-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1.25rem 0;
    color: #1a1a1a;
}

.nt-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.nt-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nt-field-full {
    width: 100%;
    margin-top: 0.75rem;
}

.nt-label {
    font-size: 0.825rem;
    font-weight: 500;
    color: #374151;
}

.nt-input {
    padding: 0.55rem 0.85rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #fff;
    color: #1a1a1a;
    box-sizing: border-box;
    width: 100%;
    font-family: inherit;
}

.nt-input:focus {
    outline: none;
    border-color: #6b7280;
}

.nt-textarea-sm {
    min-height: 80px;
    resize: vertical;
}

.nt-textarea-lg {
    min-height: 120px;
    resize: vertical;
}

.nt-hint {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-top: 0.2rem;
}

.nt-error {
    font-size: 0.78rem;
    color: #e02020;
    margin-top: 0.15rem;
}

.nt-error-global {
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

.nt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.nt-btn-cancel {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: #374151;
}

.nt-btn-cancel:hover {
    background: #f3f4f6;
}

.nt-btn-save {
    background-color: #e02020;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.nt-btn-save:hover:not(:disabled) {
    background-color: #c01a1a;
}

.nt-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.nt-empty {
    text-align: center;
    color: #6b7280;
    padding: 1.25rem 1rem;
}

.titulares-mobile-list {
    display: none;
}

.titular-mobile-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.titular-mobile-row-top {
    align-items: flex-start;
}

.titular-mobile-name-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.3rem;
    width: 68%;
    min-width: 0;
}

.titular-mobile-name {
    font-weight: 600;
    text-align: left;
    flex: 1;
}

.titular-mobile-actions {
    position: relative;
    flex-shrink: 0;
}

.titular-mobile-more {
    border: none;
    background: none;
    color: #6b7280;
    font-size: 1rem;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.titular-mobile-menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    min-width: 132px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    padding: 0.2rem;
    z-index: 15;
}

.titular-mobile-menu-item {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    font-size: 0.84rem;
    color: #1f2937;
}

.titular-mobile-menu-item:hover {
    background: #f3f4f6;
}

.titular-mobile-menu-item-danger {
    color: #dc2626;
}

.titular-mobile-menu-item-danger:hover {
    background: #fee2e2;
}

.titular-mobile-value {
    color: #1f2937;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: right;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1200px) {
    .titulares-mobile-list {
        display: block;
    }

    .titulares-table-wrapper {
        display: none;
    }
}
