:root {
    --ink: #202a31;
    --muted: #68727a;
    --paper: #fffefa;
    --canvas: #eef1f2;
    --line: #d7dddf;
    --navy: #1d3b4a;
    --navy-dark: #132d39;
    --red: #a3473d;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); font-family: "DM Sans", sans-serif; }
.page { width: min(1080px, calc(100% - 64px)); min-height: 100vh; margin: 0 auto; display: grid; grid-template-rows: auto 1fr auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 0 18px; border-bottom: 3px solid var(--navy); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 60px; height: 60px; object-fit: contain; }
.brand-copy { display: grid; gap: 3px; }
.brand-name { color: var(--navy); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.brand-subtitle { color: var(--muted); font-size: .72rem; }
.back-link { color: var(--muted); font-size: .68rem; letter-spacing: .08em; text-decoration: none; text-transform: uppercase; }
.back-link:hover { color: var(--navy); }
.header-actions { display: flex; align-items: center; gap: 20px; }
.text-button, .copy-number { padding: 0; color: var(--red); background: transparent; border: 0; cursor: pointer; font: inherit; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.text-button:hover, .copy-number:hover { color: var(--navy); }
main { display: grid; place-items: center; padding: 58px 0 72px; }
.login-panel, .dashboard { width: min(100%, 900px); padding: 38px 40px 40px; background: var(--paper); border: 1px solid var(--line); border-top: 5px solid var(--navy); box-shadow: 0 18px 42px rgba(29, 59, 74, .08); }
.login-panel { width: min(100%, 430px); }
.eyebrow { margin: 0 0 14px; color: var(--red); font-size: .68rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; color: var(--navy); font-family: Newsreader, Georgia, serif; font-size: clamp(2.6rem, 7vw, 4rem); font-weight: 500; line-height: .95; }
.intro { margin: 16px 0 30px; color: var(--muted); font-size: .88rem; line-height: 1.6; }
.field { display: grid; gap: 7px; margin-bottom: 18px; }
label { color: var(--navy); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.field-hint { margin: -1px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
input { width: 100%; padding: 13px 14px; color: var(--ink); background: #f8faf9; border: 1px solid var(--line); border-radius: 0; font: inherit; outline: none; }
input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(29, 59, 74, .12); }
.password-control { position: relative; }
.password-control input { padding-right: 48px; }
.password-toggle { position: absolute; top: 1px; right: 1px; display: grid; width: 42px; height: calc(100% - 2px); place-items: center; color: var(--muted); background: transparent; border: 0; cursor: pointer; }
.password-icon { display: block; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.eye-slash { display: none; }
.password-toggle.is-visible .eye-slash { display: block; }
.password-toggle:hover { color: var(--navy); }
.password-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: -3px; }
select, textarea { width: 100%; padding: 13px 14px; color: var(--ink); background: #f8faf9; border: 1px solid var(--line); border-radius: 0; font: inherit; outline: none; }
select:focus, textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(29, 59, 74, .12); }
.form-message { margin: 14px 0 0; color: var(--red); font-size: .78rem; line-height: 1.5; }
.helper-button { justify-self: start; padding: 0; color: var(--red); background: transparent; border: 0; cursor: pointer; font: inherit; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.helper-button:hover { color: var(--navy); }
.helper-dialog { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(29, 59, 74, .44); }
.helper-dialog[hidden] { display: none; }
.helper-dialog-panel { width: min(100%, 680px); max-height: min(760px, calc(100vh - 40px)); overflow: auto; padding: 30px; background: var(--paper); border-top: 5px solid var(--navy); box-shadow: 0 24px 60px rgba(29, 59, 74, .2); }
.helper-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.helper-dialog-header h2 { max-width: 480px; margin: 0; color: var(--navy); font-family: Newsreader, Georgia, serif; font-size: clamp(1.8rem, 4vw, 2.7rem); font-weight: 500; line-height: 1; }
.helper-close { width: 32px; height: 32px; color: var(--navy); background: transparent; border: 1px solid var(--line); cursor: pointer; font-size: 1.4rem; line-height: 1; }
.helper-close:hover { color: var(--red); border-color: var(--red); }
.helper-intro { margin: 14px 0 22px; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.helper-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.helper-option { display: grid; grid-template-rows: auto 1fr; gap: 7px; width: 100%; min-height: 96px; padding: 14px; color: var(--ink); background: #f8faf9; border: 1px solid var(--line); cursor: pointer; font: inherit; text-align: left; appearance: none; }
.helper-option:hover, .helper-option:focus-visible { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(29, 59, 74, .1); }
.helper-option strong, .helper-option span { display: block; }
.helper-option strong { color: var(--navy); font-size: .76rem; letter-spacing: .04em; line-height: 1.25; text-transform: uppercase; }
.helper-option span { color: var(--muted); font-size: .75rem; line-height: 1.45; }
.dashboard { align-self: start; }
.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
.dashboard-heading .intro { max-width: 480px; margin-bottom: 0; }
.session-label { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.session-label strong { color: var(--navy); }
.letter-form { padding-top: 28px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.field-wide { grid-column: 1 / -1; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 6px; }
.form-footer .form-message { margin: 0; }
.form-footer .submit-button { width: auto; }
.result-panel { display: grid; gap: 28px; margin-top: 34px; padding: 28px; background: #edf4f1; border-left: 4px solid var(--green, #296052); }
.result-panel h2 { margin: 0; color: var(--navy); font-family: Newsreader, Georgia, serif; font-size: clamp(1.7rem, 4vw, 2.7rem); font-weight: 500; overflow-wrap: anywhere; }
.result-meta { margin: 8px 0 0; color: var(--muted); font-size: .78rem; }
.result-actions { display: flex; align-items: center; gap: 24px; }
#result-qr { width: 132px; height: 132px; padding: 8px; background: white; }
.copy-fields { flex: 1; min-width: 0; }
.copy-fields label { display: block; margin-bottom: 7px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; }
.copy-button { padding: 0 15px; color: var(--paper); background: var(--navy); border: 0; cursor: pointer; font: inherit; font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.copy-button:hover { background: var(--navy-dark); }
.copy-number { display: block; margin-top: 14px; }
.form-options { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 26px; color: var(--muted); font-size: .76rem; }
.remember { display: flex; align-items: center; gap: 8px; }
.remember input { width: 15px; height: 15px; accent-color: var(--navy); }
.submit-button { width: 100%; padding: 14px 18px; color: var(--paper); background: var(--navy); border: 0; border-radius: 0; cursor: pointer; font: inherit; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; transition: background-color 160ms ease, transform 160ms ease; }
.submit-button:hover { background: var(--navy-dark); transform: translateY(-1px); }
.submit-button:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.site-footer { padding: 20px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: .7rem; line-height: 1.6; }
.site-footer p { margin: 0; }
@media (max-width: 760px) {
    .page { width: min(100% - 32px, 600px); }
    .site-header { padding-top: 18px; }
    .back-link, .text-button { font-size: .6rem; }
    main { padding: 40px 0 52px; }
    .login-panel, .dashboard { padding: 30px 24px 28px; }
    .dashboard-heading { display: block; }
    .session-label { margin-top: 20px; }
    .form-grid { display: block; }
    .form-footer, .result-actions { display: block; }
    .helper-options { grid-template-columns: 1fr; }
    .helper-dialog-panel { padding: 24px; }
    .form-footer .submit-button { width: 100%; margin-top: 12px; }
    #result-qr { display: block; margin-bottom: 20px; }
    .copy-row { display: grid; grid-template-columns: 1fr auto; }
}
