* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  --navy: #0d2b57;
  --navy-2: #123f76;
  --red: #e30613;
  --red-soft: #fff1f2;
  --ink: #142033;
  --muted: #607086;
  --line: #dfe6ef;
  --surface: #f7f9fc;
  --white: #ffffff;
  --success: #11744a;
  --warning: #a35b00;
  font-family: Verdana, Geneva, sans-serif;
  color: var(--ink);
  background: var(--white);
}
body { margin: 0; background: #fff; color: var(--ink); min-width: 320px; }
button, input { font: inherit; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: linear-gradient(145deg, #fff, #f7f9fc); }
.auth-card { width: min(100%, 430px); padding: 42px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 22px 60px rgba(13,43,87,.08); }
.auth-logo { width: 154px; height: 52px; object-fit: contain; object-position: left center; mix-blend-mode: multiply; margin-bottom: 34px; }
.auth-card h1 { font-size: 34px; margin-bottom: 12px; }
.auth-copy, .auth-footnote { color: var(--muted); font-size: 12px; line-height: 1.7; }
.auth-form { display: grid; gap: 9px; margin-top: 26px; }
.auth-form label, .user-form label { color: var(--navy); font-weight: bold; font-size: 11px; }
.auth-form input, .user-form input { border: 1px solid var(--line); border-radius: 7px; padding: 12px 11px; color: var(--ink); background: #fff; margin-bottom: 8px; }
.auth-form input:focus, .user-form input:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(18,63,118,.1); }
.password-field { position: relative; width: 100%; margin-bottom: 8px; }
.password-field input { width: 100%; margin-bottom: 0; padding-right: 48px; }
.password-toggle { position: absolute; top: 50%; right: 7px; display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; transform: translateY(-50%); }
.password-toggle:hover { color: var(--navy); background: var(--surface); }
.password-toggle:focus-visible { outline: 3px solid rgba(227,6,19,.25); outline-offset: 1px; }
.password-toggle[aria-pressed="true"] { color: var(--red); }
.password-eye { position: relative; display: block; width: 18px; height: 12px; border: 1.8px solid currentColor; border-radius: 100% / 75%; }
.password-eye::after { position: absolute; top: 50%; left: 50%; width: 4px; height: 4px; border-radius: 50%; background: currentColor; content: ""; transform: translate(-50%, -50%); }
.password-toggle[aria-pressed="true"] .password-eye::before { position: absolute; top: 4px; left: -3px; width: 23px; height: 1.8px; background: currentColor; content: ""; transform: rotate(-32deg); }
.form-message { min-height: 18px; color: #9b1820; font-size: 11px; line-height: 1.5; margin: 0; }
.auth-footnote { margin: 25px 0 0; font-size: 10px; }
.topbar { min-height: 78px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px clamp(20px, 5vw, 88px); background: #fff; }
.brand { display: flex; align-items: center; gap: 16px; color: var(--navy); text-decoration: none; }
.brand-logo { width: 154px; height: 52px; object-fit: contain; object-position: left center; mix-blend-mode: multiply; }
.brand-divider { height: 25px; width: 1px; background: var(--line); }
.brand-product { font-size: 13px; letter-spacing: .02em; }
.site-link { color: var(--navy-2); font-size: 12px; text-decoration: none; }
.site-link:hover { color: var(--red); }
.session-actions { display: flex; align-items: center; gap: 13px; }
.session-user { color: var(--navy); font-size: 11px; font-weight: bold; }
.logout-button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 10px; text-decoration: underline; }
.logout-button:hover { color: var(--red); }
.page-shell { width: min(1260px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 100px; }
.hero { display: flex; justify-content: space-between; gap: 32px; align-items: end; padding-bottom: 52px; }
.eyebrow { color: var(--red); font-size: 10px; font-weight: bold; letter-spacing: .14em; margin: 0 0 12px; }
h1, h2, h3, p { margin-top: 0; }
h1 { color: var(--navy); font-size: clamp(32px, 5vw, 58px); line-height: 1.05; letter-spacing: -.04em; max-width: 750px; margin-bottom: 20px; }
h2 { color: var(--navy); font-size: 23px; letter-spacing: -.02em; margin-bottom: 0; }
h3 { color: var(--navy); font-size: 18px; }
.hero-copy { color: var(--muted); font-size: 15px; line-height: 1.8; max-width: 670px; margin-bottom: 0; }
.hero-note { border-left: 3px solid var(--red); padding: 8px 0 8px 18px; min-width: 225px; color: var(--navy); display: grid; gap: 8px; font-size: 12px; line-height: 1.5; }
.hero-note span { color: var(--muted); }
.upload-card { border: 1px solid var(--line); border-radius: 18px; padding: clamp(22px, 4vw, 36px); background: linear-gradient(130deg, #fff, #fbfcfe); box-shadow: 0 18px 50px rgba(13,43,87,.06); }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 26px; }
.file-hint, .muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
.dropzone { min-height: 190px; border: 1px dashed #a9b9cc; border-radius: 12px; background: #fff; display: grid; place-items: center; align-content: center; gap: 9px; cursor: pointer; color: var(--muted); transition: .2s ease; }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--red); background: #fffafb; }
.dropzone strong { color: var(--navy); font-size: 15px; }
.dropzone small { color: var(--navy-2); max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-icon { color: var(--red); font-size: 34px; font-weight: 200; line-height: 1; }
.upload-actions { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding-top: 22px; }
.ocr-progress { margin-top: 20px; padding: 16px 18px; border: 1px solid #cbd9eb; border-radius: 10px; background: #f7faff; }
.progress-head { display: flex; justify-content: space-between; gap: 16px; color: var(--navy); font-size: 12px; }
.progress-head span { font-weight: bold; color: var(--red); }
.progress-track { height: 12px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #e5ebf4; }
.progress-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--red), #f05b63); transition: width .35s ease; }
.progress-detail { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.retry-job-button { margin-top: 13px; font-size: 11px; }
.button { border: 0; border-radius: 8px; padding: 12px 18px; font-size: 12px; font-weight: bold; cursor: pointer; text-decoration: none; display: inline-flex; justify-content: center; align-items: center; min-height: 42px; transition: .2s ease; }
.button:focus-visible, input:focus-visible, .icon-button:focus-visible { outline: 3px solid rgba(227,6,19,.25); outline-offset: 2px; }
.button-primary { color: #fff; background: var(--red); box-shadow: 0 7px 16px rgba(227,6,19,.18); }
.button-primary:hover { background: #be0510; transform: translateY(-1px); }
.button-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.button-secondary { color: var(--navy); background: #fff; border: 1px solid var(--line); }
.button-secondary:hover { border-color: var(--navy-2); }
.review-section { margin-top: 72px; }
.users-section { margin-top: 72px; padding-top: 12px; }
.users-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 22px; }
.user-form, .users-list-wrap { border: 1px solid var(--line); border-radius: 14px; padding: 22px; background: var(--surface); }
.user-form { display: grid; gap: 7px; align-content: start; }
.user-form h3, .users-list-wrap h3 { color: var(--navy); font-size: 15px; margin-bottom: 10px; }
.users-list { display: grid; gap: 8px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.user-row strong { display: block; color: var(--navy); font-size: 11px; }
.user-row small { color: var(--muted); font-size: 10px; }
.user-row .badge { margin-left: 6px; }
.user-toggle { border: 0; background: none; color: var(--red); text-decoration: underline; cursor: pointer; font-size: 10px; white-space: nowrap; }
.review-heading { align-items: center; margin-bottom: 18px; }
.review-stats { color: var(--muted); font-size: 12px; }
.month-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.month-tab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 15px; cursor: pointer; color: var(--muted); font-size: 12px; }
.month-tab[aria-selected="true"] { color: #fff; background: var(--navy); border-color: var(--navy); }
.month-tab strong { font-size: 13px; margin-right: 4px; }
.empty-state { border: 1px solid var(--line); border-radius: 15px; text-align: center; padding: 70px 24px; background: var(--surface); }
.empty-state p { max-width: 630px; margin: 0 auto; color: var(--muted); line-height: 1.7; font-size: 13px; }
.empty-mark { color: var(--red); font-size: 38px; margin-bottom: 12px; }
.month-panel { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: #fff; }
.month-toolbar { padding: 20px 22px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.month-title { color: var(--navy); font-weight: bold; font-size: 16px; }
.month-meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.month-total { text-align: right; color: var(--navy); font-weight: bold; }
.month-total small { display: block; color: var(--muted); font-weight: normal; font-size: 10px; margin-top: 4px; }
.pending-banner, .duplicate-banner { padding: 12px 22px; font-size: 11px; line-height: 1.6; }
.pending-banner { background: #fff8ed; color: var(--warning); border-bottom: 1px solid #f4dfbc; }
.duplicate-banner { background: var(--red-soft); color: #8b1a22; border-bottom: 1px solid #f4ccd0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 920px; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff; white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid #edf1f5; vertical-align: middle; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tr.is-excluded { background: #fafafa; opacity: .72; }
tr.is-pending { background: #fffdf7; }
.cell-input { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 5px; padding: 8px 7px; color: var(--ink); font-size: 12px; }
.cell-input:hover { border-color: var(--line); background: #fff; }
.cell-input:focus { outline: none; border-color: var(--navy-2); background: #fff; }
.cell-input.is-missing { border-color: #e4a943; background: #fff8ed; }
.status-stack { display: grid; gap: 5px; }
.owner-label { color: var(--navy-2); font-size: 9px; font-weight: bold; }
.badge { display: inline-flex; width: max-content; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: 9px; font-weight: bold; letter-spacing: .04em; }
.badge-pending { color: var(--warning); background: #fff0d9; }
.badge-duplicate { color: #9b1820; background: #ffe1e4; }
.badge-ok { color: var(--success); background: #e1f5ea; }
.row-actions { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.source-button { border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 6px; padding: 7px 9px; cursor: pointer; font-size: 10px; }
.source-button:hover { border-color: var(--navy-2); }
.exclude-button { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 5px 0; font-size: 10px; }
.exclude-button:hover { color: var(--red); }
.delete-button { border: 0; background: none; color: #9b1820; text-decoration: underline; cursor: pointer; padding: 5px 0; font-size: 10px; }
.delete-button:hover { color: #6f0f15; }
.source-dialog { width: min(940px, calc(100% - 32px)); border: 0; border-radius: 15px; padding: 0; box-shadow: 0 24px 90px rgba(0,0,0,.25); }
.source-dialog::backdrop { background: rgba(13,43,87,.42); }
.dialog-head { display: flex; align-items: start; justify-content: space-between; padding: 24px 26px 18px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 18px; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; }
.source-layout { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 24px; padding: 24px 26px 28px; }
.source-image-wrap { min-height: 300px; background: #f3f5f8; display: grid; place-items: center; padding: 12px; border-radius: 10px; overflow: auto; }
.source-image-wrap img { max-width: 100%; max-height: 600px; object-fit: contain; }
.source-actions { align-self: end; }
@media (max-width: 760px) {
  .topbar { padding: 0 20px; }
  .brand-logo { width: 120px; }
  .brand-product, .site-link { display: none; }
  .page-shell { width: min(100% - 28px, 1260px); padding-top: 36px; }
  .hero, .section-heading, .upload-actions, .month-toolbar { display: grid; align-items: start; }
  .hero { padding-bottom: 34px; }
  .hero-note { min-width: 0; }
  .upload-actions .button { width: 100%; }
  .review-section { margin-top: 50px; }
  .source-layout { grid-template-columns: 1fr; }
  .auth-card { padding: 30px 24px; }
  .session-user { display: none; }
  .users-grid { grid-template-columns: 1fr; }
}
