:root {
    --brand-primary: #004077;
    --brand-deep-blue: #00335f;
    --brand-green: #009e3d;
    --brand-cyan: #009fe3;
    --brand-yellow: #fec700;
    --brand-dark: #002f5d;
    --text-main: #263746;
    --brand-gray: #62686d;
    --line: #dfe2e4;
    --paper: #ffffff;
    --background: #f4f5f6;
    --success: #177447;
    --danger: #b4232d;
    --shadow: 0 18px 50px rgba(32, 36, 40, .09);
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text-main);
    background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); }
a { color: inherit; }
button, input, textarea { font: inherit; }
select { font: inherit; }

.site-header {
    display: flex;
    align-items: center;
    gap: 42px;
    padding: 32px max(5vw, 24px);
    background: var(--paper);
    border-bottom: 4px solid var(--brand-yellow);
}
.validation-identity {
    display: grid;
    gap: 4px;
    margin-left: auto;
    padding-left: 28px;
    border-left: 1px solid var(--line);
    text-align: right;
}
.validation-identity strong { color: var(--brand-primary); }
.validation-identity > span:last-child { color: var(--brand-gray); font-size: .82rem; }
.brand img { display: block; width: min(250px, 40vw); max-height: 70px; }
.site-header h1, .section-heading h2 { margin: 5px 0 0; }
h1, h2, h3 { color: var(--brand-primary); }
.eyebrow {
    color: var(--brand-gray);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.page-shell { width: min(1180px, calc(100% - 40px)); margin: 54px auto; }
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 30px;
    margin-bottom: 24px;
}
.section-heading > p { max-width: 500px; color: var(--brand-gray); }
.document-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.document-card {
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.document-card-approved {
    border: 2px solid #4c9a70;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
    box-shadow:
        0 0 0 3px rgba(76, 154, 112, .07),
        0 16px 42px rgba(23, 116, 71, .14);
}
.document-card-rejected {
    border: 2px solid #cc6670;
    background: linear-gradient(180deg, #ffffff 0%, #fff8f8 100%);
    box-shadow:
        0 0 0 3px rgba(204, 102, 112, .07),
        0 16px 42px rgba(180, 35, 45, .14);
}
.document-card-cancelled {
    border: 2px solid #b85b63;
    background: linear-gradient(180deg, #ffffff 0%, #fff8f8 100%);
    box-shadow:
        0 0 0 3px rgba(184, 91, 99, .07),
        0 16px 42px rgba(143, 43, 51, .14);
}
.document-card-approved .document-preview {
    background: linear-gradient(145deg, #e9ebed 72%, #e8f4ed 100%);
}
.document-card-rejected .document-preview {
    background: linear-gradient(145deg, #e9ebed 72%, #f8e9ea 100%);
}
.document-card-cancelled .document-preview {
    background: linear-gradient(145deg, #e9ebed 72%, #f6e5e7 100%);
}
.document-card-disabled { background: #f0f1f2; box-shadow: none; }
.document-card-disabled .document-preview img {
    filter: grayscale(1);
    opacity: .45;
}
.document-card-disabled .document-body { opacity: .68; }
.document-disabled-note { font-weight: 700; }
.document-preview { position: relative; height: 330px; padding: 22px; background: #e9ebed; text-align: center; }
.document-preview img { width: 100%; height: 100%; object-fit: contain; }
.document-body { padding: 24px; }
.document-body h3 { margin: 0 0 8px; overflow-wrap: anywhere; }
.document-body p { color: var(--brand-gray); }
.document-decision-info {
    margin: 8px 0 0;
    padding: 11px 13px;
    background: #f4f5f6;
    line-height: 1.45;
}
.document-card-approved .document-decision-info {
    color: var(--success);
    background: #e7f5ed;
}
.document-card-rejected .document-decision-info {
    color: var(--danger);
    background: #fbeaec;
}
.document-card-cancelled .document-decision-info {
    color: #8f2b33;
    background: #fbeaec;
}
.document-cancellation-comment {
    margin: 10px 0 0;
    padding: 11px 13px;
    color: #6f272d !important;
    background: #fff3f4;
    border-left: 3px solid #b85b63;
    line-height: 1.5;
}
.status {
    position: absolute;
    top: 18px;
    right: 18px;
    padding: 7px 11px;
    color: #fff;
    background: var(--brand-gray);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-approved { background: var(--success); }
.status-rejected { background: var(--danger); }
.status-cancelled { background: #8f2b33; }
.status-confirmed { background: var(--success); }
.status-failed { background: var(--danger); }
.status-queued { background: var(--brand-cyan); }
.status-not_requested { background: var(--brand-gray); }
.document-actions, .document-actions form { display: flex; flex-wrap: wrap; gap: 9px; }
.document-actions { margin-top: 22px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 15px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
}
.button-primary { color: #fff; background: var(--brand-primary); }
.button-danger { color: var(--danger); background: #fff; border-color: #e3b8bd; }
.button-secondary { color: var(--brand-primary); background: #fff; border-color: var(--line); }
.button:disabled { cursor: not-allowed; opacity: .6; }
.validation-dialog {
    width: min(620px, calc(100% - 32px));
    padding: 0;
    border: 0;
    border-top: 5px solid var(--brand-yellow);
    box-shadow: 0 24px 80px rgba(0, 47, 93, .28);
}
.validation-dialog::backdrop { background: rgba(0, 35, 65, .68); }
.validation-dialog form { position: relative; padding: 34px; }
.validation-dialog h2 { margin: 7px 42px 8px 0; }
.validation-dialog p { color: var(--brand-gray); overflow-wrap: anywhere; }
.validation-dialog textarea {
    width: 100%;
    resize: vertical;
    padding: 13px;
    border: 1px solid #bac0c4;
}
.validation-dialog textarea:focus {
    outline: 2px solid rgba(0, 159, 227, .2);
    border-color: var(--brand-cyan);
}
.dialog-close {
    position: absolute;
    top: 18px;
    right: 20px;
    border: 0;
    color: var(--brand-gray);
    background: transparent;
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
}
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 24px; }
.empty-state { padding: 60px 30px; background: #fff; border: 1px solid var(--line); text-align: center; }
.site-footer {
    display: grid;
    gap: 7px;
    padding: 34px max(5vw, 24px);
    color: #dfe2e4;
    background: var(--brand-deep-blue);
    font-size: .88rem;
}
.page-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: min(1180px, calc(100% - 40px));
    margin: 24px auto 0;
}
.upload-shell { display: grid; gap: 24px; }
.upload-panel {
    padding: clamp(24px, 4vw, 38px);
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: 4px solid var(--brand-yellow);
    box-shadow: var(--shadow);
}
.upload-panel h2 { margin: 6px 0 12px; }
.upload-panel p { max-width: 740px; color: var(--brand-gray); line-height: 1.65; }
.upload-dropzone {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    margin-top: 24px;
    padding: clamp(22px, 4vw, 36px);
    border: 2px dashed #bac0c4;
    background: #f7f8f8;
}
.upload-dropzone label { display: grid; gap: 6px; }
.upload-dropzone-title {
    color: var(--brand-primary);
    font-size: 1.25rem;
    font-weight: 800;
}
.upload-dropzone-meta { color: var(--brand-gray); }
.upload-dropzone input { width: 100%; }
.upload-section-heading { margin-bottom: 20px; }
.upload-file-list { display: grid; gap: 14px; }
.upload-file-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--line);
    background: #fff;
}
.upload-file-card h3 {
    margin: 0 0 6px;
    overflow-wrap: anywhere;
}
.upload-file-card p { margin: 0 0 10px; }
.upload-file-thumb {
    display: grid;
    place-items: center;
    width: 92px;
    aspect-ratio: 1 / 1.2;
    background: #e9ebed;
    color: var(--brand-primary);
    font-weight: 800;
}
.upload-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-file-card .status { position: static; display: inline-block; }
.upload-dropzone.is-dragging {
    border-color: var(--brand-primary);
    background: #eef5fa;
}
.upload-progress-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}
.upload-progress-item {
    display: grid;
    gap: 7px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: #fff;
}
.upload-progress-item span { color: var(--brand-gray); font-size: .86rem; }
.upload-progress-item progress { width: 100%; height: 10px; }
.upload-progress-item.is-complete { border-color: #b7dfc7; background: #f4fbf7; }
.upload-progress-item.is-error { border-color: #efc4c8; background: #fff6f7; }
.upload-processing-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    color: var(--brand-gray);
    font-size: .8rem;
}
.status-processing,
.status-running,
.status-pending { background: var(--brand-cyan); }
.status-ready,
.status-clean,
.status-passed { background: var(--success); }
.status-infected,
.status-failed { background: var(--danger); }
.status-skipped { background: var(--brand-gray); }

.company-home { display: flex; flex-direction: column; }
.company-home-header { min-height: 150px; }
.company-home-main {
    display: grid;
    gap: 24px;
    width: min(1120px, calc(100% - 40px));
    margin: 54px auto;
}
.company-home-intro,
.company-home-details {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr);
    gap: 42px;
    padding: clamp(28px, 5vw, 52px);
    background: var(--paper);
    border-top: 4px solid var(--brand-yellow);
    box-shadow: var(--shadow);
}
.company-home-intro h2,
.company-home-details h2 {
    margin: 7px 0 18px;
    font-size: clamp(1.7rem, 4vw, 2.6rem);
}
.company-home-intro p,
.company-home-details p {
    max-width: 720px;
    color: var(--brand-gray);
    line-height: 1.7;
}
.company-home-notice {
    display: grid;
    align-content: center;
    gap: 12px;
    padding: 28px;
    color: #fff;
    background: var(--brand-primary);
}
.company-home-notice span { color: #dcecf8; line-height: 1.55; }
.company-home-details { border-top-color: var(--brand-cyan); }
.company-home-details address {
    display: grid;
    align-content: center;
    gap: 12px;
    color: var(--brand-gray);
    font-style: normal;
}
.company-home-details address a { color: var(--brand-primary); }
.company-home-footer { margin-top: auto; }
.company-home-footer a { width: max-content; color: #fff; }

.validation-error-page { display: flex; flex-direction: column; }
.validation-error-main {
    display: grid;
    flex: 1;
    place-items: center;
    width: min(760px, calc(100% - 40px));
    margin: 54px auto;
}
.validation-error-card {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: clamp(32px, 7vw, 64px);
    background: var(--paper);
    border-top: 5px solid var(--brand-yellow);
    box-shadow: var(--shadow);
}
.validation-error-card h2 {
    max-width: 580px;
    margin: 8px 0 18px;
    font-size: clamp(1.8rem, 5vw, 3rem);
}
.validation-error-card p {
    max-width: 600px;
    color: var(--brand-gray);
    line-height: 1.65;
}
.validation-error-card .button { margin-top: 14px; }
.validation-error-code {
    position: absolute;
    top: -22px;
    right: 22px;
    color: rgba(0, 64, 119, .07);
    font-size: 9rem;
    font-weight: 800;
    line-height: 1;
}
.validation-error-footer { margin-top: auto; }

.login-layout { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 38px; background: #fff; border-top: 5px solid var(--brand-yellow); box-shadow: var(--shadow); }
.login-card img { width: 230px; max-width: 100%; margin-bottom: 30px; }
.field { display: grid; gap: 7px; margin: 18px 0; }
.field input,
.field textarea {
    width: 100%;
    padding: 13px;
    border: 1px solid #bac0c4;
}
.field input[type="file"] { padding: 10px; background: #fff; }
.field textarea { resize: vertical; line-height: 1.45; }
.field input:focus,
.field textarea:focus { outline: 2px solid rgba(0, 159, 227, .2); border-color: var(--brand-cyan); }
.alert { padding: 12px 14px; color: #7e1720; background: #fbeaec; border: 1px solid #efc4c8; }
.alert-success { color: #145c39; background: #e7f5ed; border-color: #b7dfc7; }

.admin-layout { min-height: 100vh; }
.admin-layout { color: var(--text-main); }
.admin-nav {
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 20px max(4vw, 24px);
    color: #fff;
    background: var(--brand-deep-blue);
}
.admin-nav img { width: 190px; max-height: 48px; filter: brightness(0) invert(1); }
.admin-nav a { text-decoration: none; }
.admin-nav .spacer { flex: 1; }
.admin-main { width: calc(100% - 24px); margin: 30px auto; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 22px; }
.search-form { display: flex; gap: 8px; }
.search-form input { min-width: min(390px, 55vw); padding: 11px 13px; border: 1px solid #bac0c4; }
.table-wrap { overflow-x: auto; background: #fff; box-shadow: var(--shadow); }
.table-wrap .status { position: static; display: inline-block; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--brand-gray); background: #f7f8f8; font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; }
.admin-data-table { font-size: .82rem; }
.admin-data-table th,
.admin-data-table td { padding: 10px 11px; }
.uploads-table { table-layout: fixed; }
.uploads-table th:nth-child(1) { width: 46px; }
.uploads-table th:nth-child(2) { width: 9%; }
.uploads-table th:nth-child(3) { width: 17%; }
.uploads-table th:nth-child(4) { width: 105px; }
.uploads-table th:nth-child(5) { width: 92px; }
.uploads-table th:nth-child(6) { width: 11%; }
.uploads-table th:nth-child(7) { width: 13%; }
.uploads-table th:nth-child(8) { width: 16%; }
.uploads-table th:nth-child(9) { width: 76px; }
.uploads-table th:nth-child(10) { width: 190px; }
.admin-section-heading { margin: 30px 0 14px; }
.admin-section-heading h2 { margin: 4px 0 0; }
.job-requests-table { table-layout: fixed; margin-bottom: 28px; }
.job-requests-table th:nth-child(1) { width: 52px; }
.job-requests-table th:nth-child(2) { width: 11%; }
.job-requests-table th:nth-child(3) { width: 17%; }
.job-requests-table th:nth-child(4) { width: 18%; }
.job-requests-table th:nth-child(5) { width: 12%; }
.job-requests-table th:nth-child(6) { width: 18%; }
.job-requests-table th:nth-child(7) { width: 92px; }
.job-requests-table th:nth-child(8) { width: 86px; }
.request-admin-cell,
.mail-status-cell,
.request-files-cell { white-space: normal; }
.admin-muted {
    display: block;
    margin-top: 6px;
    color: var(--brand-gray);
    font-size: .76rem;
    line-height: 1.35;
}
.expandable-cell { overflow: hidden; }
.expandable-value { min-width: 0; }
.expandable-value summary {
    overflow: hidden;
    cursor: pointer;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.expandable-value summary::marker { color: var(--brand-primary); }
.expandable-value > span,
.expandable-value > code {
    display: block;
    margin-top: 8px;
    overflow-wrap: anywhere;
    white-space: normal;
}
.expandable-value > code { font-size: .75rem; }
.options-cell { min-width: 0; white-space: normal; }
.upload-options summary { cursor: pointer; color: var(--brand-primary); font-weight: 700; }
.proof-source-list { display: grid; gap: 10px; margin-top: 12px; }
.proof-source {
    display: grid;
    gap: 5px;
    padding: 11px;
    background: #f7f8f8;
    border-left: 3px solid var(--brand-cyan);
    font-size: .82rem;
}
.proof-source code { overflow-wrap: anywhere; color: var(--brand-primary); }
.source-path { overflow-wrap: anywhere; color: var(--brand-gray); font-family: Consolas, monospace; }
.raw-options { margin-top: 12px; }
.raw-options pre {
    overflow: auto;
    max-width: 680px;
    max-height: 320px;
    padding: 12px;
    color: #f4f5f6;
    background: #202428;
    font: .78rem/1.45 Consolas, monospace;
    white-space: pre-wrap;
}
.mail-action-cell { white-space: normal; }
.agent-requeue-form { margin-top: 8px; }
.validation-admin-cell {
    min-width: 220px;
    white-space: normal;
}
.validation-audit-summary {
    display: block;
    margin-top: 7px;
    color: var(--brand-gray);
}
.validation-comment-details,
.validation-cancel-details {
    margin-top: 8px;
}
.validation-comment-details summary,
.validation-cancel-details summary {
    cursor: pointer;
    color: var(--brand-primary);
    font-weight: 700;
}
.validation-comment-details p {
    margin: 8px 0 0;
    overflow-wrap: anywhere;
    color: var(--brand-gray);
    line-height: 1.45;
}
.validation-cancel-details form {
    display: grid;
    gap: 9px;
    margin-top: 10px;
}
.validation-cancel-details label {
    display: grid;
    gap: 5px;
    color: var(--brand-gray);
    font-size: .76rem;
    font-weight: 700;
}
.validation-cancel-details textarea {
    width: 100%;
    min-width: 210px;
    padding: 8px;
    resize: vertical;
    border: 1px solid #bac0c4;
    font-size: .8rem;
    font-weight: 400;
}
.mail-replay-form { display: flex; align-items: center; gap: 5px; }
.mail-replay-form select {
    min-width: 0;
    width: 92px;
    padding: 6px;
    border: 1px solid #bac0c4;
    background: #fff;
    font: .75rem Consolas, monospace;
}
.button-compact { min-height: 30px; padding: 5px 8px; font-size: .72rem; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; }
.settings-card { padding: 24px; background: #fff; border-top: 3px solid var(--brand-yellow); box-shadow: var(--shadow); }
.settings-card dt { margin-top: 16px; color: var(--brand-gray); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.settings-card dd { margin: 5px 0 0; white-space: pre-line; }
.smtp-form { margin-bottom: 36px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 0 20px; }
.field select { width: 100%; padding: 13px; border: 1px solid #bac0c4; background: #fff; }
.checkbox-field { display: flex; align-items: center; gap: 10px; margin: 16px 0; }
.checkbox-field input { width: 18px; height: 18px; }
input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .42; }
.form-help { color: var(--brand-gray); line-height: 1.55; }
.code-preview { overflow: auto; max-height: 430px; padding: 18px; color: #f4f5f6; background: #202428; font: .83rem/1.55 Consolas, monospace; white-space: pre; }
.asset-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.asset-form { display: grid; gap: 4px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 18px;
    margin: 8px 0 18px;
}
.company-user-list { display: grid; gap: 14px; }
.user-editor {
    padding: 0;
    border: 1px solid var(--line);
    background: #fff;
}
.user-editor summary {
    display: grid;
    grid-template-columns: minmax(150px, .8fr) minmax(85px, .4fr) minmax(220px, 1.2fr);
    gap: 14px;
    padding: 15px;
    cursor: pointer;
    align-items: center;
}
.user-editor summary span { color: var(--brand-gray); }
.user-editor .company-user-form,
.delete-user-form {
    margin: 0;
    padding: 18px;
    border-top: 1px solid var(--line);
}
.delete-user-form { background: #fff8f8; }

@media (max-width: 720px) {
    .site-header, .section-heading, .toolbar, .admin-nav { align-items: flex-start; flex-direction: column; }
    .company-home-intro, .company-home-details { grid-template-columns: 1fr; }
    .admin-nav .spacer { display: none; }
    .document-actions form { width: 100%; }
    .upload-dropzone { grid-template-columns: 1fr; }
    .upload-file-card { grid-template-columns: 1fr; }
    .validation-identity {
        margin-left: 0;
        padding: 16px 0 0;
        border-top: 1px solid var(--line);
        border-left: 0;
        text-align: left;
    }
    .user-editor summary { grid-template-columns: 1fr; }
}
