@font-face { font-family: "Proxima"; src: url("/proxima-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Proxima"; src: url("/proxima-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
:root {
  --navy: #172c49; --blue: #1c4587; --orange: #e69138; --paper: #f4f7fb; --panel: #ffffff; --ink: #172c49; --muted: #5f6e82;
  --line: #e2e7ed; --block: #b3261e; --block-bg: #fdecea; --warn: #8a5300; --warn-bg: #fff4e2; --ok: #1d6b4f; --ok-bg: #e5f4ed;
  --focus: #1c4587; --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); font: 15px/1.45 "Proxima", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
[hidden] { display: none !important; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
.brand img { height: 30px; }
.brand span { padding-left: 12px; border-left: 1px solid rgba(255,255,255,.35); }
.env-pill { background: var(--orange); color: var(--navy); font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; }
.top-nav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.top-nav a, .top-nav .link { color: #dfe7f2; text-decoration: none; }
.top-nav a:hover, .top-nav .link:hover { color: #fff; text-decoration: underline; }
.who { color: #b9c6d8; font-size: 13px; }
.link { background: none; border: 0; padding: 0; cursor: pointer; }
#signout { margin: 0; }

/* Layout */
#app { padding: 20px; max-width: 1500px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 16px; flex-wrap: wrap; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.notice { border-left: 4px solid var(--orange); }
.card h2 .count { color: var(--muted); font-weight: 400; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.spacer { flex: 1; }

/* Buttons and inputs */
.button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 8px 14px; cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 600; }
.button:hover { border-color: #c7d0dc; }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:hover { background: #163a72; }
.button.warn { background: var(--orange); border-color: var(--orange); color: var(--navy); }
.button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { width: 100%; border: 1px solid #cfd7e2; border-radius: 6px; padding: 7px 9px; background: #fff; }
textarea { resize: vertical; min-height: 56px; }
input:focus, select:focus, textarea:focus, .button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 190px; min-width: 0; margin-bottom: 10px; }
.field.wide { flex-basis: 100%; }
.field > span { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.req { color: var(--block); }
.tag { background: #e8eef8; color: var(--blue); border-radius: 4px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.tag.scan { background: var(--warn-bg); color: var(--warn); }
.source-link { border: 0; background: none; color: var(--blue); padding: 0; font-size: 12px; cursor: pointer; text-decoration: underline; }
.check-line { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.check-line input { width: auto; }

/* Dashboard */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] { max-width: 320px; }
.newfile { display: flex; gap: 8px; align-items: center; }
.newfile input { width: 200px; }
table.files { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.files th, .files td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.files th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: #f9fbfd; }
.files tbody tr { cursor: pointer; }
.files tbody tr:hover { background: #f6f9fd; }
.files .num { text-align: right; }
.stage { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; background: #eef2f7; color: var(--muted); white-space: nowrap; }
.stage.go { background: var(--ok-bg); color: var(--ok); }
.stage.attn { background: var(--warn-bg); color: var(--warn); }
.stage.stop { background: var(--block-bg); color: var(--block); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.tf-status { font-size: 14px; color: var(--muted); }

/* File page */
.back { display: inline-block; margin-bottom: 6px; text-decoration: none; }
.file-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 42%); gap: 18px; align-items: start; }
.steps { display: flex; gap: 0; margin: 0 0 16px; padding: 0; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.steps li { flex: 1; padding: 10px 12px; font-size: 13px; color: var(--muted); border-right: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.steps li:last-child { border-right: 0; }
.steps .dot { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: #e4e9f0; color: var(--muted); flex: none; }
.steps .done { color: var(--ok); } .steps .done .dot { background: var(--ok); color: #fff; }
.steps .now { color: var(--ink); font-weight: 700; } .steps .now .dot { background: var(--blue); color: #fff; }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.slot { border: 1px dashed #c7d0dc; border-radius: var(--radius); padding: 12px; }
.slot.have { border-style: solid; border-color: #9ccbb6; background: var(--ok-bg); }
.slot strong { display: block; }
.slot .sub { font-size: 13px; display: block; margin: 2px 0 8px; }
.slot input[type=file] { font-size: 12px; padding: 4px; }
.bar { height: 6px; background: #e4e9f0; border-radius: 3px; overflow: hidden; margin: 6px 0; }
.bar span { display: block; height: 100%; background: var(--blue); transition: width .4s; }
.notes { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 8px 10px; border-radius: 6px; margin-bottom: 6px; }
.notes .block { background: var(--block-bg); color: var(--block); }
.notes .warn { background: var(--warn-bg); color: var(--warn); }
.notes .good { background: var(--ok-bg); color: var(--ok); }
.pages { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 4px; }
.pages button { border: 1px solid var(--line); background: #fff; border-radius: 4px; min-width: 28px; padding: 2px 6px; font-size: 12px; cursor: pointer; }
.pages button.extra { border-color: var(--orange); }
.pages button.current { background: var(--blue); border-color: var(--blue); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.fees { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.fees th, .fees td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.fees th { font-size: 12px; color: var(--muted); }
.fees .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fees tfoot td { font-weight: 700; border-bottom: 0; }
.fee-help { font-size: 12px; color: var(--muted); }
.qa label { display: block; margin-bottom: 10px; }
.qa label > span { display: block; font-size: 14px; margin-bottom: 4px; }
.log { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.prior { border-left: 3px solid var(--line); padding: 4px 10px; margin: 8px 0; font-size: 13px; }

/* Page viewer */
.viewer { position: sticky; top: 70px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 90px); }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.viewer-tools { display: flex; gap: 4px; }
.viewer-tools button { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 3px 9px; cursor: pointer; font-size: 13px; }
.viewer-body { overflow: auto; padding: 10px; background: #eef2f7; flex: 1; min-height: 420px; }
.viewer-body img { display: block; margin: 0 auto; background: #fff; box-shadow: 0 1px 4px rgba(23,44,73,.15); transform-origin: center; }
.viewer-empty { color: var(--muted); text-align: center; padding: 60px 20px; }

/* Admin */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
.simple th, .simple td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.simple th { color: var(--muted); font-size: 12px; }

/* Dialog and toast */
dialog { border: 0; border-radius: var(--radius); padding: 20px; max-width: 440px; box-shadow: 0 10px 40px rgba(23,44,73,.3); }
dialog::backdrop { background: rgba(23,44,73,.45); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
#toast { position: fixed; right: 20px; bottom: 20px; max-width: 460px; background: var(--navy); color: #fff; padding: 12px 16px; border-radius: var(--radius); z-index: 20; box-shadow: 0 6px 24px rgba(23,44,73,.3); }
#toast.bad { background: var(--block); }

/* Sign-in page */
.signin-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); }
.signin-card { background: #fff; border-radius: 12px; padding: 36px 32px; width: min(420px, calc(100vw - 32px)); text-align: center; }
.signin-logo { height: 44px; background: var(--navy); padding: 8px 14px; border-radius: 8px; }
.signin-card h1 { margin: 16px 0 4px; }
.signin-env { display: inline-block; background: var(--orange); color: var(--navy); font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.signin-button { justify-content: center; width: 100%; margin: 10px 0; padding: 11px; }
.signin-note { color: var(--block); }
.signin-small { color: var(--muted); font-size: 13px; }

@media (max-width: 1050px) {
  .file-grid, .admin-grid { grid-template-columns: 1fr; }
  .viewer { position: static; max-height: none; }
  .slots { grid-template-columns: 1fr; }
  .steps { flex-wrap: wrap; } .steps li { flex: 1 1 45%; }
  .top { flex-wrap: wrap; } .top-nav { gap: 12px; }
}

/* Accepting a difference between documents */
#accept { max-width: 560px; }
#accept textarea { width: 100%; box-sizing: border-box; font: inherit; margin-top: 4px; }
table.compare { width: 100%; border-collapse: collapse; margin: 10px 0; }
table.compare th { text-align: left; width: 30%; padding: 6px 8px; vertical-align: top; text-transform: capitalize; }
table.compare td { padding: 6px 8px; white-space: pre-line; background: #f5f7fa; border-radius: 4px; }
.notes li.accepted { background: var(--ok-bg); color: var(--ok); }
.notes li .why { display: block; font-size: .9em; opacity: .8; margin-top: 2px; }
