/* THE_PROCESSOR — design tokens
   Grammar of the interface = grammar of the filenames it produces.
   Cool document paper + iron ink; safety orange is the one accent (worksite
   hi-vis, Working for Workers); stamp green marks verified/complete;
   flag red marks quarantine/placeholders. */
:root {
  --paper: #eff0eb;
  --card: #fbfbf8;
  --ink: #171a1f;
  --ink-soft: #545a61;
  --rule: #c9ccc2;
  --rule-soft: #dfe1d9;
  --hivis: #f25c05;
  --hivis-deep: #c44a02;
  --stamp: #17694b;
  --flag: #a8271d;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: system-ui, "Segoe UI", Roboto, "Liberation Sans", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.tok { font-family: var(--mono); font-size: 0.92em; }
.tok-flag { color: var(--flag); }

:focus-visible { outline: 2px solid var(--hivis); outline-offset: 2px; }

/* ---------------------------------------------------------------- masthead */
.masthead {
  background: var(--ink);
  color: var(--paper);
  padding: 26px clamp(16px, 5vw, 56px) 22px;
  border-bottom: 4px solid var(--hivis);
}
.wordmark {
  font-family: var(--mono);
  font-size: clamp(16px, 2.6vw, 23px);
  font-weight: 700;
  letter-spacing: 0.02em;
  word-break: break-all;
}
.wordmark .brk { color: var(--hivis); font-weight: 400; }
.masthead-sub { margin-top: 6px; color: #b9bdb4; font-size: 14px; }
.masthead-sub .tok { color: var(--paper); }
.masthead-user { font-family: var(--mono); font-size: 12px; margin-left: 14px; color: #8d929a; }
.masthead-link { color: #b9bdb4; margin-left: 14px; }
.masthead-link:hover { color: var(--paper); }

/* ---------------------------------------------------------------- stages */
.stages { max-width: 1020px; margin: 0 auto; padding: 12px clamp(14px, 4vw, 40px) 60px; }

.stage { margin-top: 40px; opacity: 0.45; transition: opacity 0.35s ease; }
.stage.active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .stage { transition: none; } }

.stage-head {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.stage-num { color: var(--hivis); }
.stage-head::after { content: ""; flex: 1; border-top: 1px solid var(--rule); margin-left: 14px; }
.stage-note { color: var(--ink-soft); max-width: 64ch; margin-bottom: 16px; }

/* ---------------------------------------------------------------- dropzone */
.dropzone {
  position: relative;
  background: var(--card);
  border: 2px dashed var(--rule);
  padding: 44px 24px 36px;
  text-align: center;
  cursor: pointer;
  margin-top: 18px;
}
.dz-tab {          /* the folder tab — every exhibit is a folder */
  position: absolute;
  top: -14px; left: 24px;
  width: 130px; height: 14px;
  background: var(--card);
  border: 2px dashed var(--rule);
  border-bottom: none;
}
.dropzone.dragover, .dropzone.dragover .dz-tab { border-color: var(--hivis); }
.dropzone.dragover { background: #fff7f1; }
.dz-title { font-family: var(--mono); font-size: 21px; font-weight: 700; letter-spacing: 0.05em; }
.dz-sub { color: var(--ink-soft); margin-top: 6px; }
.dz-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.dz-limits { margin-top: 18px; font-size: 12.5px; color: var(--ink-soft); }

.btn-ghost {
  font-family: var(--sans);
  font-size: 14px;
  background: none;
  border: 1px solid var(--ink);
  color: var(--ink);
  padding: 8px 16px;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

.upload-progress { margin-top: 14px; }
.up-bar { height: 10px; background: var(--rule-soft); }
.up-fill { height: 100%; width: 0%; background: var(--hivis); transition: width 0.2s; }
.up-text { font-family: var(--mono); font-size: 12.5px; margin-top: 6px; color: var(--ink-soft); }

/* ---------------------------------------------------------------- review */
.ticket {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--stamp);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
}
.ticket.excluded { border-left-color: var(--rule); opacity: 0.55; }
.ticket-thumb {
  width: 76px; height: 76px;
  object-fit: cover;
  border: 1px solid var(--rule);
  background: #fff;
}
.ticket-glyph {
  width: 76px; height: 76px;
  border: 1px solid var(--rule);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--ink-soft); letter-spacing: 0.08em;
}

.ticket-name {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 2.1;
  word-break: break-all;
}
.t-num { color: var(--stamp); font-weight: 700; }
.t-brk { color: var(--ink-soft); }

.t-date {
  font-family: var(--mono);
  font-size: 13.5px;
  width: 13.5ch;
  border: none;
  border-bottom: 1.5px solid var(--rule);
  background: transparent;
  color: var(--ink);
  padding: 0 1px;
}
.t-date.bad { border-bottom-color: var(--flag); color: var(--flag); }
.t-desc {
  font-family: var(--mono);
  font-size: 13.5px;
  min-width: 24ch;
  max-width: 100%;
  border: none;
  border-bottom: 1.5px solid var(--hivis);
  background: transparent;
  color: var(--ink);
  padding: 0 1px;
  text-transform: uppercase;
}
.t-desc::placeholder { color: var(--flag); opacity: 0.75; text-transform: none; }
.t-date:focus, .t-desc:focus { outline: none; border-bottom-width: 2.5px; }

.ticket-meta {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 6px;
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  align-items: baseline;
}
.chip {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 7px;
  border: 1px solid currentColor;
}
.chip-image, .chip-pdf { color: var(--stamp); }
.chip-eml { color: var(--hivis-deep); }
.meta-warn { color: var(--flag); }
.sha { font-family: var(--mono); font-size: 11.5px; }
.t-include { accent-color: var(--stamp); width: 16px; height: 16px; }
.include-lab { display: flex; gap: 6px; align-items: center; cursor: pointer; }

/* email attachments */
.atts { grid-column: 1 / -1; border-top: 1px dashed var(--rule); padding-top: 10px; margin-top: 4px; }
.atts-head { font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; color: var(--ink-soft); margin-bottom: 8px; }
.att-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  padding: 5px 0; font-size: 13px; }
.att-name { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.att-standalone { display: flex; gap: 6px; align-items: center; cursor: pointer;
  color: var(--ink-soft); font-size: 12.5px; }
.att-standalone input { accent-color: var(--hivis); }
.att-desc { display: none; }
.att-row.standalone .att-desc { display: inline-block; }

/* quarantine + unsupported */
.qpanel, .upanel {
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 12px 16px;
  margin-bottom: 14px;
}
.qpanel { border-left: 4px solid var(--flag); }
.upanel { border-left: 4px solid var(--rule); }
.qpanel-head, .upanel-head { font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: 0.1em; margin-bottom: 6px; }
.qpanel-head { color: var(--flag); }
.upanel-head { color: var(--ink-soft); }
.qpanel li, .upanel li { font-family: var(--mono); font-size: 12.5px;
  list-style: none; padding: 2px 0; word-break: break-all; color: var(--ink-soft); }
.qpanel .why, .upanel .why { font-family: var(--sans); font-size: 12px; }

/* build bar */
.build-bar { display: flex; align-items: center; gap: 18px; margin-top: 20px; flex-wrap: wrap; }
.build-count { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
.btn-build {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--hivis);
  color: #fff;
  border: none;
  padding: 13px 26px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-build:hover { background: var(--hivis-deep); }
.btn-build:disabled { background: var(--rule); cursor: default; }

/* ---------------------------------------------------------------- ledger */
.ledger {
  background: var(--ink);
  color: #d8dbd2;
  font-family: var(--mono);
  font-size: 12.8px;
  line-height: 1.75;
  padding: 18px 20px;
  min-height: 160px;
  max-height: 460px;
  overflow-y: auto;
  overflow-x: auto;
}
.led-line { white-space: pre-wrap; word-break: break-all; }
.led-time { color: #7c8188; margin-right: 10px; }
.led-num { color: #7fc8a9; font-weight: 700; }
.led-stage {
  color: var(--paper);
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 10px 0 4px;
  padding-top: 8px;
  border-top: 1px solid #3a3f45;
}
.led-item { color: #ffb27d; font-weight: 700; margin-top: 8px; }
.led-error { color: #ff8d80; font-weight: 700; }
.led-done { color: #7fc8a9; font-weight: 700; }

/* ---------------------------------------------------------------- download */
.zip-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--stamp);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
  flex-wrap: wrap;
}
.zip-glyph {
  width: 58px; height: 46px;
  background: var(--stamp);
  position: relative;
  flex: none;
}
.zip-glyph::before {       /* folder tab */
  content: "";
  position: absolute;
  top: -8px; left: 0;
  width: 24px; height: 8px;
  background: var(--stamp);
}
.zip-glyph::after {        /* zip teeth */
  content: "";
  position: absolute;
  left: 27px; top: 0; bottom: 0;
  width: 4px;
  background: repeating-linear-gradient(var(--card) 0 4px, transparent 4px 8px);
}
.zip-meta { flex: 1; min-width: 220px; }
.zip-name { font-weight: 700; font-size: 15px; word-break: break-all; }
.zip-sub { color: var(--ink-soft); font-size: 13px; margin-top: 4px; }
.after-note { color: var(--ink-soft); font-size: 13px; margin: 14px 0 18px; max-width: 70ch; }
.after-note .tok-flag { font-weight: 700; }

.pagefoot {
  text-align: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  padding: 26px 16px 34px;
  border-top: 1px solid var(--rule);
}

/* ---------------------------------------------------------------- login */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--hivis);
  padding: 34px 34px 26px;
  max-width: 520px;
  width: 100%;
}
.login-card .wordmark { color: var(--ink); font-size: 14.5px; word-break: keep-all; overflow-wrap: normal; }
.login-card .wordmark .brk { color: var(--hivis); }
.login-note { color: var(--ink-soft); font-size: 13.5px; margin: 12px 0 22px; }
.hash-table {
  display: grid;
  grid-template-columns: auto 1fr;
  border: 1.5px solid var(--ink);
}
.hash-label {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
  border-right: 1.5px solid var(--ink);
  display: flex; align-items: center;
}
.hash-value {
  font-family: var(--mono);
  font-size: 14px;
  border: none;
  background: transparent;
  padding: 10px 12px;
  letter-spacing: 0.2em;
}
.hash-value:focus { outline: none; background: #fff7f1; }
.hash-row2 { border-top: 1.5px solid var(--ink); }
.login-foot a { color: var(--ink-soft); }
.login-btn { grid-column: 1 / -1; border-top: 1.5px solid var(--ink); text-align: center; }
.login-error { color: var(--flag); font-size: 13px; margin-top: 14px; }
.login-foot {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 26px;
}

/* ---------------------------------------------------------------- small screens */
@media (max-width: 560px) {
  .ticket { grid-template-columns: 1fr; }
  .ticket-thumb, .ticket-glyph { width: 100%; height: 120px; object-fit: cover; }
  .t-desc { min-width: 14ch; }
}
