:root {
    --green-900: #03351f;
    --green-800: #044427;
    --green-700: #075c36;
    --green-600: #0b6b3c;
    --gold: #e3c56b;
    --paper: #fbf8f1;
    --paper-2: #f5efe4;
    --line: #ded8cb;
    --text: #1f2933;
    --muted: #66737d;
    --white: #fffdf8;
    --shadow: 0 18px 45px rgba(20, 34, 28, .12);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
    margin: 0;
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: linear-gradient(135deg, var(--paper) 0%, #fffdf8 55%, #eef7ef 100%);
}

h1, h2, h3 {
    margin: 0;
    color: #132018;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }

input, select, textarea, button {
    font: inherit;
    letter-spacing: 0;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fffdf8;
    color: var(--text);
    padding: 12px 13px;
    outline: none;
    min-height: 44px;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px rgba(11, 107, 60, .12);
}

label {
    display: grid;
    gap: 7px;
    color: #59646c;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

button { cursor: pointer; }

.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

.button, .ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px;
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid transparent;
    font-weight: 700;
    white-space: nowrap;
}

.button {
    background: var(--green-700);
    color: white;
    box-shadow: 0 10px 22px rgba(7, 92, 54, .18);
}

.button:hover { background: var(--green-800); }
.button.small { min-height: 34px; padding-inline: 14px; font-size: 13px; }
.button.full, .ghost-button.full { width: 100%; }

.ghost-button {
    background: #fffdf8;
    border-color: var(--line);
    color: var(--green-800);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 7px;
    background: var(--green-700);
    color: white;
}

.brand-mark.gold { background: var(--gold); color: var(--green-900); }
.brand.inverse { color: white; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 76px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
    border-bottom: 1px solid rgba(96, 84, 65, .18);
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.landing {
    min-height: calc(100vh - 140px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 440px;
    gap: 56px;
    align-items: center;
    max-width: 1120px;
    margin: 0 auto;
    padding: 56px 24px;
}

.hero-copy h1 {
    max-width: 560px;
    margin: 18px 0;
    color: #06331f;
    font-size: clamp(42px, 6vw, 66px);
    line-height: 1.05;
}

.hero-copy p {
    max-width: 580px;
    color: #59646c;
    line-height: 1.65;
}

.pill {
    display: inline-flex;
    border: 1px solid #d8cfbd;
    border-radius: 999px;
    padding: 7px 12px;
    background: #fbf4df;
    font-size: 12px;
    font-weight: 700;
}

.feature-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 42px;
}

.feature-row article {
    display: grid;
    gap: 5px;
    min-height: 76px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 248, .78);
    padding: 14px;
}

.feature-row small { color: var(--muted); }

.sample-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.sample-head, .sample-card dl div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.sample-head {
    margin-bottom: 14px;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 800;
}

.sample-head small {
    background: #fbf4df;
    color: #4b4023;
    border-radius: 4px;
    padding: 4px 6px;
}

.sample-card dl { margin: 0; }
.sample-card dl div { border-bottom: 1px dashed #c9c4b8; padding: 10px 0; }
.sample-card dt { color: #58646d; }
.sample-card dd { margin: 0; font-weight: 700; text-align: right; }

.signature-box {
    min-height: 86px;
    margin-top: 18px;
    border: 1px dashed #c9c4b8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #59646c;
}

.public-footer {
    border-top: 1px solid rgba(96, 84, 65, .18);
    padding: 24px;
    text-align: center;
    color: #748088;
    font-size: 12px;
}

.auth-page {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
    min-height: 100vh;
    padding: 10px;
}

.auth-aside {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--green-800);
    color: white;
    border-radius: 0 0 0 12px;
    padding: 44px;
}

.auth-aside h1 {
    max-width: 620px;
    color: white;
    font-size: clamp(28px, 4vw, 43px);
    line-height: 1.14;
}

.auth-aside p { color: rgba(255,255,255,.86); }

.auth-form {
    display: grid;
    place-items: center;
    padding: 24px;
}

.form-card {
    width: min(100%, 390px);
}

.form-card h2 { font-size: 30px; }
.form-card p { color: var(--muted); }
.form-card label { margin-top: 18px; }
.form-links { text-align: center; }
.form-links a, .back-link { color: var(--green-800); font-weight: 700; }
.back-link { display: block; margin-top: 18px; text-align: center; color: #69767f; }

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #012d1b;
    color: white;
}

.brand-internal {
    padding: 30px;
    font-size: 17px;
}

.brand-internal span:last-child {
    display: grid;
    gap: 2px;
}

.brand-internal small {
    color: rgba(255,255,255,.72);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 12px;
}

.side-nav {
    display: grid;
    gap: 6px;
    padding: 20px 14px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    border-radius: 7px;
    padding: 0 16px;
    color: rgba(255,255,255,.86);
}

.side-nav a.active, .side-nav a:hover {
    background: #064b2d;
    color: var(--gold);
}

.side-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 18px;
    color: rgba(255,255,255,.58);
    font-size: 12px;
}

.main-panel {
    padding: 36px;
    overflow: hidden;
}

.menu-toggle { display: none; }

.eyebrow {
    margin: 0 0 8px;
    color: #b89d46;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.page-heading h1 { font-size: clamp(32px, 4vw, 46px); }
.lead { max-width: 760px; margin: 8px 0 32px; color: #55636d; font-size: 17px; line-height: 1.55; }

.alert {
    margin: 18px 0;
    border-radius: 8px;
    padding: 13px 15px;
    font-weight: 700;
}

.alert.success { background: #e8f5ee; color: #075c36; border: 1px solid #b7dfca; }
.alert.danger { background: #fff0ee; color: #a33224; border: 1px solid #f0c0ba; }

.stats-grid, .shortcut-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin: 24px 0 42px;
}

.stats-grid article, .shortcut-grid a, .panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,253,248,.9);
    box-shadow: 0 12px 30px rgba(37, 44, 40, .06);
}

.stats-grid article {
    position: relative;
    min-height: 112px;
    padding: 22px;
}

.stats-grid span {
    color: #687680;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.stats-grid strong {
    display: block;
    margin-top: 20px;
    font: 700 30px Georgia, "Times New Roman", serif;
}

.stats-grid .icon {
    position: absolute;
    top: 22px;
    right: 20px;
    color: var(--green-700);
}

.shortcut-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.shortcut-grid a {
    display: grid;
    gap: 10px;
    min-height: 160px;
    padding: 28px;
}

.shortcut-grid span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    background: var(--green-700);
    color: white;
}

.shortcut-grid strong { font-family: Georgia, "Times New Roman", serif; font-size: 22px; }
.shortcut-grid small { color: #59646c; line-height: 1.4; }

.panel { padding: 22px; margin-bottom: 24px; }
.panel h2 { margin-bottom: 18px; font-size: 22px; }

.empty {
    padding: 34px;
    text-align: center;
    color: #66737d;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: #61707a; font-size: 12px; text-transform: uppercase; }
td { color: #303b43; }
.table-action { color: var(--green-700); font-weight: 800; }
.actions { display: flex; gap: 12px; }
.muted-action { color: #7d8a93; font-weight: 700; }

.register-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, .9fr);
    gap: 24px;
}

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

.upload-box, .preview-zone {
    border: 1px dashed #c9c4b8;
    border-radius: 6px;
    min-height: 132px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    text-align: center;
    color: var(--green-800);
    cursor: pointer;
}

.upload-box input { display: none; }
.upload-box small { color: var(--muted); text-transform: none; font-weight: 500; }

.preview-zone {
    margin-top: 18px;
    min-height: 150px;
    color: #7c858b;
    cursor: default;
}

.preview-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.preview-grid img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line);
}

.data-panel label + label, .data-panel .split, .data-panel .button { margin-top: 15px; }
.split { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }

.button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
}

.search-bar, .filters-panel {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,253,248,.9);
    padding: 16px;
    margin-bottom: 24px;
}

.report-actions {
    display: grid;
    gap: 14px;
}

.filters-panel {
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
}

.action-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.office-list { display: grid; gap: 10px; }
.office-list div {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding: 11px 0;
}

.viewer-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 24px;
}

.detail-list {
    display: grid;
    gap: 14px;
    margin: 0 0 22px;
}

.detail-list div {
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
}

.detail-list dt {
    color: #687680;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.detail-list dd { margin: 5px 0 0; }

.stack-actions { margin-bottom: 12px; }
.small-empty { padding: 14px; border: 1px dashed var(--line); border-radius: 6px; }

.pdf-panel { padding: 0; overflow: hidden; min-height: 74vh; }
.pdf-panel iframe { width: 100%; height: 74vh; border: 0; background: white; }

.image-viewer {
    display: grid;
    gap: 12px;
    padding: 22px;
}

.stored-image-row {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fffdf8;
    padding: 14px;
    color: #40505b;
}

@media (max-width: 980px) {
    .landing, .auth-page, .app-shell, .register-grid, .viewer-layout {
        grid-template-columns: 1fr;
    }

    .sample-card { order: -1; }
    .auth-aside { min-height: 420px; border-radius: 0; }
    .sidebar {
        position: fixed;
        z-index: 10;
        inset: 0 auto 0 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .main-panel { padding: 24px; }
    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: white;
        color: var(--green-800);
        margin-bottom: 18px;
    }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .topbar { height: auto; padding: 18px; }
    .brand { font-size: 17px; }
    .landing { padding: 28px 18px; gap: 28px; }
    .hero-copy h1 { font-size: 42px; }
    .feature-row, .shortcut-grid, .stats-grid, .upload-actions, .search-bar, .filters-panel, .split {
        grid-template-columns: 1fr;
    }
    .button-row { grid-template-columns: 1fr; }
    .auth-page { padding: 0; }
    .auth-aside { padding: 28px; }
    .auth-form { padding: 28px 18px; }
    .page-heading { align-items: flex-start; }
    .page-heading form { display: none; }
    .main-panel { padding: 18px; }
    .actions { flex-direction: column; }
}

@media print {
    .sidebar, .menu-toggle, .page-heading form, .action-row, .search-bar, .ghost-button { display: none !important; }
    .app-shell, .main-panel { display: block; padding: 0; }
    body { background: white; }
    .panel, .stats-grid article { box-shadow: none; }
}
