:root {
    --brand-primary: #004077;
    --brand-green: #009e3d;
    --brand-cyan: #009fe3;
    --brand-yellow: #fec700;
    --brand-dark: #003330;
    --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(--brand-dark);
    background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); }
a { color: inherit; }
button, input { 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);
}
.brand img { display: block; width: min(250px, 40vw); max-height: 70px; }
.site-header h1, .section-heading h2 { margin: 5px 0 0; }
.eyebrow {
    color: var(--brand-primary);
    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-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); }
.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); }
.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-dark); background: #fff; border-color: var(--line); }
.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-dark);
    font-size: .88rem;
}

.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 { width: 100%; padding: 13px; border: 1px solid #bac0c4; }
.field input: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-nav {
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 20px max(4vw, 24px);
    color: #fff;
    background: var(--brand-dark);
}
.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: min(1380px, calc(100% - 40px)); margin: 42px 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; }
.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; }
.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; }

@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%; }
}
