.tp-add-page {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 88px);
    max-height: calc(100dvh - 88px);
    overflow: hidden;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    box-sizing: border-box;
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.tp-add-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* Tabs */
.tp-add-tabs {
    flex: 0 0 auto;
    border-bottom: 1px solid #dee2e6;
    padding: 0 0.75rem;
    gap: 0.25rem;
}

.tp-tab-link {
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
    color: #495057 !important;
    font-size: 0.875rem;
    font-weight: 500;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    padding: 0.65rem 0.85rem !important;
    margin-bottom: -1px;
    background: transparent !important;
}

.tp-tab-link:hover:not(.disabled):not(.active) {
    color: #1b6ec2 !important;
}

.tp-tab-link.active {
    color: #1b6ec2 !important;
    font-weight: 600;
    border-bottom-color: #1b6ec2 !important;
}

.tp-tab-link.disabled {
    color: #adb5bd !important;
    opacity: 1;
}

.tp-tab-icon {
    width: 1rem;
    height: 1rem;
}

/* Form body */
.tp-add-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.tp-add-form-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.85rem 1rem 0.5rem;
}

.tp-validation-summary {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

/* Sections */
.tp-section {
    margin-bottom: 0.25rem;
}

.tp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.tp-section-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5c6670;
}

.tp-section-icon {
    width: 1rem;
    height: 1rem;
    color: #6c757d;
}

.tp-required-badge {
    font-size: 0.68rem;
    font-weight: 600;
    color: #1b6ec2;
    background: #e8f2fc;
    border: 1px solid #cfe2f8;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    white-space: nowrap;
}

.tp-section-divider {
    margin: 0.65rem 0 0.75rem;
    border-color: #e9ecef;
    opacity: 1;
}

.tp-field-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
}

.tp-optional {
    font-weight: 400;
    color: #868e96;
    font-size: 0.75rem;
}

.tp-field-input {
    border: 1px solid #ced4da;
    border-radius: 0.35rem;
    font-size: 0.875rem;
    padding: 0.4rem 0.65rem;
    min-height: 2.125rem;
}

.tp-field-input::placeholder {
    color: #adb5bd;
}

.tp-field-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.15rem rgba(27, 110, 194, 0.12);
}

/* Activo box */
.tp-active-box {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.4rem;
    padding: 0.45rem 0.65rem;
    min-height: 2.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-active-switch {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding-left: 2.5em;
}

.tp-active-switch .form-check-input {
    width: 2.25em;
    height: 1.15em;
    margin-left: -2.5em;
    cursor: pointer;
}

.tp-active-switch .form-check-input:checked {
    background-color: #1b6ec2;
    border-color: #1b6ec2;
}

.tp-active-switch .form-check-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
}

.tp-add-form .validation-message {
    font-size: 0.7rem;
    margin-top: 0.1rem;
}

/* Footer */
.tp-add-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: #fff;
    border-top: 1px solid #dee2e6;
}

.tp-footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border-radius: 0.35rem;
    text-decoration: none;
    line-height: 1.4;
}

.tp-footer-btn-outline {
    background: #fff !important;
    border: 1px solid #ced4da !important;
    color: #495057 !important;
}

.tp-footer-btn-outline:hover {
    background: #f8f9fa !important;
    color: #212529 !important;
    border-color: #adb5bd !important;
}

.tp-footer-btn-primary {
    background: #1b6ec2 !important;
    border: 1px solid #1861ac !important;
    color: #fff !important;
}

.tp-footer-btn-primary:hover:not(:disabled) {
    background: #1861ac !important;
    border-color: #145a9e !important;
    color: #fff !important;
}

.tp-footer-btn-primary :deep(svg) {
    fill: #fff;
}

.tp-footer-btn:disabled {
    opacity: 0.65;
}

.tp-btn-icon {
    width: 0.95rem;
    height: 0.95rem;
}

.tp-mode-badge {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #495057;
    background: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    white-space: nowrap;
}

.tp-mode-badge--readonly {
    color: #0c5460;
    background: #d1ecf1;
    border-color: #bee5eb;
}

/* Legacy-style master form (label column + fields, actions under form) */
.tp-legacy-form {
    max-width: 52rem;
    padding: 0.25rem 0 0.5rem;
}

.tp-legacy-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.tp-legacy-row--top {
    align-items: flex-start;
}

.tp-legacy-row--top .tp-legacy-label {
    padding-top: 0.45rem;
}

.tp-legacy-label {
    flex: 0 0 7.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
    text-align: left;
}

.tp-legacy-fields {
    flex: 1 1 auto;
    min-width: 0;
}

.tp-legacy-fields--transportista {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.tp-transporter-code {
    flex: 0 0 6.5rem;
    max-width: 6.5rem;
}

.tp-transporter-name {
    flex: 1 1 auto;
    min-width: 0;
}

.tp-legacy-fields--split {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.tp-legacy-fields--split > .tp-field-input:first-of-type {
    flex: 1 1 12rem;
    min-width: 10rem;
    max-width: 16rem;
}

.tp-legacy-inline-label {
    flex: 0 0 auto;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
    padding-left: 0.25rem;
}

.tp-fax-field {
    flex: 1 1 12rem;
    min-width: 10rem;
    max-width: 16rem;
}

.tp-truck-code,
.tp-driver-code {
    max-width: 8rem;
}

.tp-cedula-field {
    max-width: 14rem;
}

.tp-legacy-row--badge {
    margin-bottom: 0.35rem;
}

.tp-plate-field {
    max-width: 12rem;
}

.tp-legacy-fields--numeric {
    max-width: 10rem;
}

.tp-numeric-field {
    text-align: right;
}

.tp-address-area {
    min-height: 5.5rem;
    resize: vertical;
}

.tp-status-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    min-height: 2.125rem;
}

.tp-status-check .form-check-input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
}

.tp-status-check .form-check-input:checked {
    background-color: #1b6ec2;
    border-color: #1b6ec2;
}

.tp-status-check .form-check-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
}

.tp-form-actions {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e9ecef;
}

@media (max-width: 576px) {
    .tp-legacy-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
    }

    .tp-legacy-label {
        flex: none;
    }

    .tp-legacy-fields--transportista {
        flex-direction: column;
        align-items: stretch;
    }

    .tp-transporter-code {
        flex: 1 1 auto;
        max-width: none;
    }

    .tp-legacy-fields--split > .tp-field-input:first-of-type,
    .tp-fax-field {
        max-width: none;
    }
}

/* Configuration list grids */
.tp-grid .k-grid-header .k-table-th,
.tp-grid .k-grid-header th.k-header {
    background-color: #dbe7f5 !important;
    color: #1f2937 !important;
}

.tp-grid-detail .k-grid-header .k-table-th,
.tp-grid-detail .k-grid-header th.k-header {
    background-color: #e2ebf8 !important;
    color: #1f2937 !important;
}

@media (max-width: 768px) {
    .tp-add-page {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .tp-add-card {
        height: auto;
    }

    .tp-add-form-content {
        overflow: visible;
    }
}
