:root {
    color-scheme: light;
    --ink: #1b2028;
    --muted: #68707c;
    --paper: #f7f3eb;
    --red: #912020;
    --line: rgba(27, 32, 40, 0.14);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    color: var(--ink);
    background: #e7e2d8;
    font-family: Georgia, 'Times New Roman', serif;
    -webkit-user-select: none;
    user-select: none;
}

button, input { font: inherit; }

.login-page {
    background: radial-gradient(circle at 15% 15%, #f9f5ec 0, #e4ded2 45%, #ccc4b8 100%);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-card {
    width: min(100%, 780px);
    padding: 46px;
    background: rgba(250, 247, 240, 0.94);
    border: 1px solid rgba(27, 32, 40, 0.16);
    box-shadow: 0 28px 70px rgba(40, 35, 29, 0.18);
}

.brand-mark {
    width: 48px;
    height: 56px;
    display: grid;
    place-items: center;
    color: white;
    background: var(--red);
    font-size: 25px;
    font-weight: bold;
    clip-path: polygon(0 0, 75% 0, 100% 20%, 100% 100%, 0 100%);
}

.brand-mark.small { width: 27px; height: 32px; font-size: 14px; }
.eyebrow { margin: 25px 0 8px; color: var(--red); font: 700 11px/1.2 Arial, sans-serif; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(30px, 7vw, 42px); line-height: 1.05; font-weight: normal; }
.agreement-copy { margin: 22px 0 26px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.agreement-copy p { margin: 0 0 14px; }
.agreement-copy ul { margin: 0 0 18px; padding-left: 22px; }
.agreement-copy li { margin-bottom: 8px; }
label { display: block; margin: 16px 0 7px; font: 700 12px Arial, sans-serif; }
input { width: 100%; padding: 13px 14px; border: 1px solid #bbb3a7; border-radius: 2px; background: #fff; outline: none; }
input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(145, 32, 32, .1); }
.agreement-check { display: grid; grid-template-columns: 22px 1fr; align-items: start; gap: 12px; margin: 0; padding: 18px; border: 1px solid #bbb3a7; background: #fff; font-size: 13px; line-height: 1.5; cursor: pointer; }
.agreement-check input { width: 18px; height: 18px; margin: 1px 0 0; padding: 0; accent-color: var(--red); }
.login-card button { width: 100%; margin-top: 22px; padding: 14px; border: 0; color: white; background: var(--ink); cursor: pointer; }
.login-card button:hover { background: var(--red); }
.notice { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font: 11px/1.5 Arial, sans-serif; }
.alert { margin: 0 0 20px; padding: 12px; border-left: 3px solid var(--red); background: #f5dfdc; font: 13px/1.4 Arial, sans-serif; }

.toolbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 10;
    height: 62px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 24px;
    color: #f5f2eb;
    background: #191c21;
    border-bottom: 1px solid #343942;
    font: 12px Arial, sans-serif;
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: bold; }
.document-status { color: #aeb5bf; letter-spacing: .04em; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: #78a784; }
.toolbar form { justify-self: end; }
.logout { padding: 8px 12px; color: #d4d7dc; border: 1px solid #494f59; background: transparent; cursor: pointer; }
.logout:hover { color: white; border-color: #8d949e; }

.document-shell { min-height: 100vh; display: grid; grid-template-columns: 235px 1fr; padding-top: 62px; }
.side-panel { position: fixed; top: 62px; bottom: 0; width: 235px; padding: 30px 24px; background: #dcd6ca; border-right: 1px solid var(--line); overflow-wrap: anywhere; }
.side-panel .eyebrow { margin-top: 0; }
.side-panel strong { font-size: 14px; }
.side-panel small { display: block; margin-top: 6px; color: var(--muted); font: 10px Arial, sans-serif; }
.rule { height: 1px; margin: 26px 0; background: var(--line); }
.security-copy { color: var(--muted); font: 12px/1.65 Arial, sans-serif; }
.stage { grid-column: 2; min-width: 0; padding: 38px 24px 96px; }
.page-wrap { position: relative; width: min(100%, 960px); min-height: 600px; margin: auto; display: grid; place-items: center; }
canvas { display: block; max-width: 100%; height: auto; background: white; box-shadow: 0 10px 35px rgba(32, 29, 25, .23); transition: opacity .15s; }
canvas.is-loading { opacity: .35; }
.loading { position: absolute; padding: 13px 18px; color: white; background: rgba(25, 28, 33, .88); font: 12px Arial, sans-serif; }
.page-controls { position: fixed; z-index: 5; bottom: 22px; left: calc(50% + 117px); transform: translateX(-50%); display: flex; align-items: center; gap: 20px; padding: 8px; color: #e8e9eb; background: #20242a; box-shadow: 0 8px 25px rgba(0,0,0,.25); font: 12px Arial, sans-serif; }
.page-controls button { width: 36px; height: 32px; color: white; border: 1px solid #4b515b; background: transparent; cursor: pointer; }
.page-controls button:disabled { opacity: .3; cursor: default; }
.capture-shield { position: fixed; z-index: 100; inset: 0; display: none; place-content: center; gap: 8px; text-align: center; color: white; background: #171a1f; font: 14px Arial, sans-serif; }
.capture-shield strong { font: normal 32px Georgia, serif; }
.capture-shield span { color: #aeb5bf; }
.capture-shield.visible { display: grid; }

@media (max-width: 720px) {
    .toolbar { grid-template-columns: 1fr auto; padding: 0 14px; }
    .document-status { display: none; }
    .brand > span:last-child { display: none; }
    .document-shell { display: block; }
    .side-panel { position: static; width: auto; padding: 16px 18px; }
    .side-panel .rule, .security-copy { display: none; }
    .side-panel .eyebrow { display: inline; margin-right: 8px; }
    .stage { padding: 20px 10px 90px; }
    .page-wrap { min-height: 300px; }
    .page-controls { left: 50%; bottom: 12px; }
    .login-card { padding: 32px 26px; }
}

@media print {
    body * { display: none !important; }
    body::after { content: 'Printing this protected document is not permitted.'; display: block; padding: 40px; font: 20px Arial, sans-serif; }
}
