* {
    box-sizing: border-box;
}

:root {
    --primary: #163f70;
    --primary-dark: #0e2b4c;
    --accent: #c69a43;
    --background: #f4f6f9;
    --border: #e2e7ee;
    --text: #1c2b3a;
    --muted: #687789;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
}

.page-container {
    width: min(1600px, calc(100% - 48px));
    margin: 34px auto;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.eyebrow {
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

h1 {
    margin: 7px 0 6px;
    color: var(--primary-dark);
    font-size: clamp(25px, 3vw, 36px);
    font-weight: 750;
}

.page-header p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.header-badge {
    border: 1px solid #d9c08d;
    border-radius: 999px;
    background: #fffaf0;
    color: #806020;
    font-size: 12px;
    font-weight: 700;
    padding: 10px 16px;
    white-space: nowrap;
}

.table-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(22, 63, 112, 0.06);
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.table-toolbar h2 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 17px;
}

#searchInput {
    width: min(300px, 100%);
    border: 1px solid #ccd5df;
    border-radius: 7px;
    outline: none;
    padding: 10px 12px;
    font: inherit;
}

#searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 63, 112, 0.1);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 1150px;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf0f4;
    text-align: left;
    vertical-align: top;
    line-height: 1.45;
}

th {
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

th span {
    color: #dce8f6;
    font-size: 11px;
    font-weight: 500;
}

td {
    color: #35475a;
    font-size: 12px;
}

td:first-child,
th:first-child {
    width: 29%;
}

th:nth-child(2),
th:nth-child(3) {
    width: 17%;
}

th:nth-child(4) {
    width: 16%;
}

th:nth-child(5) {
    width: 21%;
}

.document-name {
    color: var(--primary-dark);
    font-weight: 650;
}

tbody tr:nth-child(even) {
    background: #fbfcfe;
}

tbody tr:hover {
    background: #f1f6fc;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.empty-state {
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.page-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    color: #8390a0;
    font-size: 12px;
}

@media (max-width: 700px) {
    .page-container {
        width: min(100% - 24px, 1600px);
        margin: 20px auto;
    }

    .page-header,
    .table-toolbar,
    .page-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-badge {
        white-space: normal;
    }

    .table-toolbar {
        padding: 16px;
    }

    #searchInput {
        width: 100%;
    }
}


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

.logout-button {
    display: inline-block;
    border: 1px solid #d7b4b4;
    border-radius: 999px;
    background: #fff6f6;
    color: #9a3535;
    font-size: 12px;
    font-weight: 700;
    padding: 10px 16px;
    text-decoration: none;
    transition: background 0.2s ease;
}

.logout-button:hover {
    background: #fbe6e6;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(14, 43, 76, 0.96), rgba(22, 63, 112, 0.9)),
        var(--background);
}

.login-card {
    width: min(100%, 430px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: 34px;
}

.login-brand {
    margin-bottom: 26px;
    text-align: center;
}

.login-brand h1 {
    font-size: 27px;
    margin: 10px 0 8px;
}

.login-brand p {
    margin: 0;
    color: var(--muted);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
}

.form-group input {
    width: 100%;
    border: 1px solid #ccd5df;
    border-radius: 8px;
    outline: none;
    padding: 12px 13px;
    color: var(--text);
    font: inherit;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 63, 112, 0.1);
}

.login-button {
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 13px 16px;
    transition: background 0.2s ease;
}

.login-button:hover {
    background: var(--primary-dark);
}

.login-error {
    border: 1px solid #f1caca;
    border-radius: 8px;
    background: #fff1f1;
    color: #a33131;
    font-size: 13px;
    margin-bottom: 18px;
    padding: 11px 12px;
}

.login-hint {
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
    margin-top: 24px;
    padding-top: 18px;
    text-align: center;
}

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

    .login-card {
        padding: 26px 22px;
    }
}


.form-card {
    margin-bottom: 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(22, 63, 112, 0.05);
    padding: 24px;
}

.form-card h2 {
    margin: 0 0 20px;
    color: var(--primary-dark);
    font-size: 17px;
}

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

.form-grid label {
    display: block;
    margin-bottom: 7px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
}

.form-grid input,
.form-grid select {
    width: 100%;
    min-height: 42px;
    border: 1px solid #ccd5df;
    border-radius: 8px;
    background: #fff;
    padding: 10px 12px;
    font: inherit;
}

.full-width {
    grid-column: 1 / -1;
}

.notice {
    border-radius: 8px;
    margin-bottom: 18px;
    padding: 12px 14px;
    font-size: 13px;
}

.notice.success {
    background: #edf9f0;
    border: 1px solid #b8e2c2;
    color: #226b35;
}

.notice.error {
    background: #fff1f1;
    border: 1px solid #f1caca;
    color: #a33131;
}

.status {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.status-ok {
    background: #e9f7ee;
    color: #26733c;
}

.status-pending {
    background: #fff4df;
    color: #996b16;
}

.status-review {
    background: #eef5fc;
    color: var(--primary);
}

.status-observed {
    background: #fff1f1;
    color: #a33131;
}

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

    .full-width {
        grid-column: auto;
    }
}


.action-button {
    display: inline-block;
    border: 1px solid #b8cce3;
    border-radius: 7px;
    background: #eef5fc;
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    padding: 8px 10px;
    text-decoration: none;
    white-space: nowrap;
}

.action-button:hover {
    background: #dfeefa;
}


.file-actions {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
}

.file-actions .action-button {
    font-size: 11px;
    padding: 6px 10px;
}


/* ===== Diseño con menú lateral Choice Aduanas ===== */
:root {
    --choice-blue: #123f73;
    --choice-blue-dark: #0b2b50;
    --choice-red: #b52a32;
    --choice-red-dark: #8f2028;
    --choice-gold: #d3a54a;
    --background: #f5f7fb;
}

body {
    background: #f5f7fb;
}

.app-layout {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    width: 264px;
    padding: 25px 16px 18px;
    background: linear-gradient(180deg, var(--choice-blue-dark), var(--choice-blue));
    box-shadow: 8px 0 28px rgba(10, 39, 73, .12);
}

.sidebar-brand {
    padding: 5px 14px 28px;
    border-bottom: 1px solid rgba(255,255,255,.16);
    text-align: center;
}

.sidebar-brand img {
    width: 100%;
    max-width: 205px;
    max-height: 70px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    padding: 9px 12px;
}

.brand-caption {
    margin-top: 12px;
    color: #dce8f7;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.6px;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
    margin-top: 28px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #dce8f7;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    transition: .2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    border-color: rgba(255,255,255,.14);
    background: rgba(255,255,255,.12);
    color: #fff;
}

.sidebar-link.active {
    box-shadow: inset 4px 0 0 var(--choice-gold);
}

.nav-icon {
    display: inline-grid;
    width: 23px;
    height: 23px;
    place-items: center;
    color: #f0c76d;
    font-size: 19px;
}

.sidebar-bottom {
    margin-top: auto;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 9px;
    border-top: 1px solid rgba(255,255,255,.16);
    color: #fff;
}

.user-avatar {
    display: grid;
    width: 35px;
    height: 35px;
    place-items: center;
    border-radius: 50%;
    background: var(--choice-red);
    font-weight: 800;
}

.sidebar-user strong,
.sidebar-user small {
    display: block;
}

.sidebar-user strong { font-size: 12px; }
.sidebar-user small { margin-top: 3px; color: #b8cbe0; font-size: 10px; }

.sidebar-logout {
    display: block;
    margin-top: 7px;
    padding: 11px 12px;
    border-radius: 8px;
    color: #f3d9da;
    font-size: 12px;
    text-decoration: none;
}

.lookup-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lookup-row input {
    min-width: 0;
}

.lookup-row .action-button {
    min-height: 42px;
    cursor: pointer;
}

.lookup-row .action-button:disabled {
    cursor: wait;
    opacity: .65;
}

.field-help {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

.field-help-error {
    color: #a33131;
}

.field-help-success {
    color: #26733c;
}

.inline-form {
    display: inline;
}

.notice.notice-info {
    border: 1px solid #c7d9ed;
    background: #eef5fc;
    color: var(--primary-dark);
}

.workflow-help,
.workflow-inline-help {
    color: var(--muted);
    line-height: 1.5;
}

.workflow-inline-help {
    margin: 0 20px 16px;
    font-size: 12px;
}

.requirement-form {
    display: grid;
    gap: 18px;
}

.requirement-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
}

.requirement-option {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--text);
    line-height: 1.45;
    cursor: pointer;
}

.requirement-option input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--choice-blue);
}

.required-summary {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 20px;
    color: var(--text);
}

.send-review-form .action-button {
    border-color: var(--choice-blue);
    background: var(--choice-blue);
    color: #fff;
    font-size: 12px;
    padding: 10px 14px;
}

.send-review-form .action-button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
}

.customs-order-box {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #edf0f5;
}

.customs-order-box h3 {
    margin: 0 0 7px;
    color: var(--choice-blue);
    font-size: 16px;
}

.customs-order-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
}

.customs-order-form label {
    display: grid;
    gap: 5px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.customs-order-form input,
.customs-order-form select {
    min-width: 105px;
    border: 1px solid #ccd5df;
    border-radius: 7px;
    background: #fff;
    padding: 9px 10px;
    color: var(--text);
    font: inherit;
}

.customs-order-form [name="numero_orden"] {
    width: 150px;
}

.order-preview {
    flex-basis: 100%;
    color: var(--muted);
    font-size: 12px;
}

.document-review-form {
    display: grid;
    gap: 7px;
    min-width: 190px;
    margin-top: 10px;
}

.document-review-form select,
.document-review-form textarea {
    width: 100%;
    border: 1px solid #ccd5df;
    border-radius: 7px;
    background: #fff;
    padding: 8px 9px;
    color: var(--text);
    font: inherit;
    font-size: 12px;
}

.document-review-form textarea {
    resize: vertical;
}

.review-comment {
    margin-top: 7px;
    border-left: 3px solid #c75b5b;
    padding: 5px 8px;
    background: #fff7f7;
    color: #7d3030;
    font-size: 12px;
    line-height: 1.4;
}

.review-meta {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.muted-label {
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 520px) {
    .lookup-row {
        align-items: stretch;
        flex-direction: column;
    }

    .requirement-list {
        grid-template-columns: 1fr;
    }
}

.sidebar-logout:hover { background: rgba(181,42,50,.24); color: #fff; }

.main-content {
    width: calc(100% - 264px);
    margin-left: 264px;
}

.page-container {
    width: min(1600px, calc(100% - 48px));
    margin: 34px auto;
}

.page-header {
    align-items: center;
}

.page-header h1 { letter-spacing: -.7px; }

.table-card,
.form-card {
    border-radius: 14px;
    box-shadow: 0 10px 35px rgba(18,63,115,.07);
}

.table-toolbar {
    border-bottom: 1px solid #edf0f5;
}

.table-toolbar h2,
.form-card h2 { color: var(--choice-blue); }

table thead th {
    background: var(--choice-blue);
}

.login-logo {
    display: block;
    width: min(100%, 240px);
    max-height: 80px;
    object-fit: contain;
    margin: 0 auto 20px;
}

.mobile-menu-button,
.sidebar-overlay { display: none; }

@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
    .sidebar.open { transform: translateX(0); }
    .main-content { width: 100%; margin-left: 0; }
    .mobile-menu-button {
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1100;
        display: grid;
        width: 42px;
        height: 42px;
        place-items: center;
        border: 0;
        border-radius: 10px;
        background: var(--choice-blue);
        color: #fff;
        cursor: pointer;
        font-size: 20px;
    }
    .sidebar-overlay.show {
        position: fixed;
        inset: 0;
        z-index: 900;
        display: block;
        background: rgba(5,20,37,.5);
    }
    .page-container { width: min(100% - 30px, 1600px); margin-top: 78px; }
}
