/* =====================================================================
   Cress Co PIM Specification Converter  --  Cress.css
   Dedicated, isolated stylesheet for the /PIM/ application ONLY.

   - Light mode only. No dark mode.
   - Desktop-first, responsive.
   - Accessible: visible focus, adequate contrast, readable text.
   - Scoped to the application shell (.app-header/.app-main/etc). It does
     not use bare element rules that could leak into another page if this
     file were ever loaded elsewhere.

   Brand colours (CressCo Brand Guidelines):
     Primary Navy  #1A3264
     Primary Lime  #CDCE00
   ===================================================================== */

:root {
  --navy: #1A3264;
  --navy-90: #26407a;
  --navy-70: #566490;
  --navy-40: #a6b0c8;
  --navy-12: #e6e9f1;
  --lime: #CDCE00;
  --lime-dark: #9a9b00;
  --lime-tint: #f5f5cc;

  --ink: #1b2233;
  --ink-soft: #4a5468;
  --line: #d9dee8;
  --bg: #f4f6fa;
  --card: #ffffff;

  --ok: #1c7c4a;
  --ok-bg: #e5f3ea;
  --warn: #8a6d00;
  --warn-bg: #fbf3d5;
  --err: #b21f2d;
  --err-bg: #fbe7e8;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px rgba(26, 50, 100, .08), 0 4px 16px rgba(26, 50, 100, .06);
  --font: "Museo Sans", "Century Gothic", "Futura", "Avenir Next", "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--navy-90); }
a:hover { color: var(--navy); }

:focus-visible {
  outline: 3px solid var(--lime-dark);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Header / nav ---------- */
.app-header {
  background: var(--navy);
  color: #fff;
}
.app-header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
}
.app-header__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
}
.app-header__sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--navy-90);
}
.brandmark {
  display: flex;
  align-items: baseline;
  gap: 2px;
  text-decoration: none;
  letter-spacing: .12em;
  font-weight: 700;
  font-size: 20px;
}
.brandmark__cress { color: var(--lime); }
.brandmark__co { color: #fff; }
.brandmark__tag {
  margin-left: 12px;
  font-weight: 400;
  letter-spacing: .02em;
  font-size: 12px;
  color: var(--navy-40);
  text-transform: uppercase;
}
.app-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.app-nav--primary { gap: 6px; }
.app-nav--primary .app-nav__link { font-weight: 600; }
.app-subnav { display: flex; flex-wrap: wrap; gap: 4px; margin-right: auto; }
.app-nav__link {
  color: #e9ecf5;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.app-subnav .app-nav__link { font-size: 13px; padding: 5px 10px; }
.app-nav__link:hover { background: var(--navy-90); color: #fff; }
.app-nav__link.is-active { background: var(--lime); color: var(--navy); font-weight: 600; }
.app-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-size: 13px;
  color: var(--navy-40);
}
.app-user__name { color: #fff; font-weight: 600; }

/* ---------- Main / layout ---------- */
.app-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 60px;
}
.layout-wide .app-main { max-width: 1420px; }

.app-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
  color: var(--ink-soft);
  font-size: 12px;
}

h1 { font-size: 26px; line-height: 1.25; margin: 0 0 8px; color: var(--navy); font-weight: 700; }
h2 { font-size: 19px; margin: 26px 0 12px; color: var(--navy); font-weight: 700; }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--navy); text-transform: uppercase; letter-spacing: .06em; }
p { margin: 0 0 12px; }
.lead { font-size: 17px; color: var(--ink-soft); }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.card--tight { padding: 16px; }
.card__title { margin-top: 0; }

/* ---------- Dashboard notice (admin-editable, shown on the hub) ---------- */
.dash-notice {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--lime-tint);
  border: 1px solid var(--lime);
  border-left: 5px solid var(--lime);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.dash-notice__label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--lime);
  border-radius: 999px;
  padding: 2px 9px;
  margin-top: 1px;
}
.dash-notice__body { color: var(--ink); font-size: 15px; line-height: 1.5; }
.dash-notice--off { opacity: 0.55; }

.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- Metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.metric__value { font-size: 28px; font-weight: 700; color: var(--navy); }
.metric__label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.metric--ok .metric__value { color: var(--ok); }
.metric--warn .metric__value { color: var(--warn); }
.metric--err .metric__value { color: var(--err); }

/* ---------- Buttons ---------- */
.btn, button.btn, input[type="submit"].btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { background: var(--navy-90); border-color: var(--navy-90); color: #fff; }
.btn--lime { background: var(--lime); border-color: var(--lime); color: var(--navy); }
.btn--lime:hover { background: var(--lime-dark); border-color: var(--lime-dark); color: var(--navy); }
.btn--ghost { background: transparent; color: var(--navy); }
.btn--ghost:hover { background: var(--navy-12); color: var(--navy); }
.btn--danger { background: var(--err); border-color: var(--err); }
.btn--danger:hover { background: #8f1a25; border-color: #8f1a25; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn--sm { padding: 5px 10px; font-size: 13px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; color: var(--navy); }
.field { margin-bottom: 16px; }
.field__help { font-weight: 400; font-size: 12px; color: var(--ink-soft); margin: 2px 0 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--navy-40);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); }
.input--narrow { max-width: 320px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; }
legend { font-weight: 700; color: var(--navy); padding: 0 6px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th, table.data td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th {
  background: var(--navy-12);
  color: var(--navy);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
table.data tbody tr:hover td { background: #fafbfe; }
table.data tr:hover td { background: #fafbfe; }

/* ---------- Pills / status ---------- */
.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--navy-12);
  color: var(--navy);
  white-space: nowrap;
}
.pill--ready, .pill--validated, .pill--processed, .pill--exported, .pill--confirmed { background: var(--ok-bg); color: var(--ok); }
.pill--needs_review, .pill--review, .pill--processing, .pill--queued { background: var(--warn-bg); color: var(--warn); }
.pill--error, .pill--failed, .pill--cancelled { background: var(--err-bg); color: var(--err); }
.pill--role { background: var(--lime-tint); color: var(--navy); }

/* ---------- Notices ---------- */
.notice {
  border: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  background: var(--card);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.notice--success { border-left-color: var(--ok); background: var(--ok-bg); }
.notice--error   { border-left-color: var(--err); background: var(--err-bg); }
.notice--warn    { border-left-color: var(--warn); background: var(--warn-bg); }
.notice--info    { border-left-color: var(--navy); }

/* ---------- Review UI ---------- */
.review-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
.product-list { position: sticky; top: 12px; align-self: start; max-height: calc(100vh - 40px); overflow-y: auto; }
.product-list__item {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}
.product-list__item.is-active { border-color: var(--navy); background: var(--navy-12); }
.product-list__item small { display: block; color: var(--ink-soft); }

.field-row {
  display: grid;
  grid-template-columns: 220px 1fr 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.field-row__name { font-weight: 600; color: var(--navy); font-size: 14px; }
.field-row__source { font-size: 12px; color: var(--ink-soft); }
.field-row__source blockquote { margin: 4px 0 0; padding-left: 8px; border-left: 2px solid var(--navy-40); }
.tag-override {
  display: inline-block;
  background: var(--lime);
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tag-reviewed {
  display: inline-block;
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid var(--ok);
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tag-reviewed::before { content: "\2713\00a0"; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.filters a {
  font-size: 13px;
  padding: 5px 10px;
  border: 1px solid var(--navy-40);
  border-radius: 999px;
  text-decoration: none;
  color: var(--navy);
  background: #fff;
}
.filters a.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }

.issue-list { margin: 0; padding-left: 18px; font-size: 13px; }
.issue-list li.sev-error { color: var(--err); }
.issue-list li.sev-review { color: var(--warn); }
.issue-list li.sev-warning { color: var(--ink-soft); }

/* ---------- Review UI: product tabs + document preview ---------- */
.ptab-strip {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px 2px 10px; margin: 4px 0 16px;
  border-bottom: 1px solid var(--line);
}
.ptab {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; text-decoration: none; color: var(--ink-soft);
  font-size: 13px; white-space: nowrap;
}
.ptab:hover { border-color: var(--navy-40); color: var(--ink); }
.ptab.is-active { border-color: var(--navy); color: var(--navy); font-weight: 600; box-shadow: inset 0 -2px 0 var(--lime); }
.ptab__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--navy-40); }
.ptab__dot--ready { background: var(--ok); }
.ptab__dot--needs_review { background: var(--warn); }
.ptab__dot--error { background: var(--err); }

.review-split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.review-split__doc { position: sticky; top: 12px; }
.review-split__form { min-width: 0; }

.doc-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; color: var(--ink-soft); }
.doc-toolbar__name { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.doc-toolbar select { font-size: 12px; padding: 3px 6px; }

.doc-preview {
  position: relative; overflow: auto;
  height: calc(100vh - 230px); min-height: 420px;
  background: #eceff4; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px;
}
.doc-preview__msg { color: var(--ink-soft); font-size: 13px; text-align: center; padding: 28px 16px; }
.doc-preview__msg a { color: var(--navy); }

.doc-txt {
  white-space: pre-wrap; word-wrap: break-word; margin: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55;
  background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 16px 18px; color: #222;
}
.doc-docx { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 24px 28px; font-size: 13px; line-height: 1.6; color: #222; }
.doc-docx table { border-collapse: collapse; margin: 8px 0; }
.doc-docx td, .doc-docx th { border: 1px solid #ccc; padding: 3px 7px; }
.doc-docx img { max-width: 100%; height: auto; }
.doc-xlsx__sheet { font-size: 12px; font-weight: 600; color: var(--navy); margin: 12px 0 4px; }
.doc-xlsx__sheet:first-child { margin-top: 0; }
.doc-xlsx__grid { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.doc-xlsx table { border-collapse: collapse; font-size: 12px; }
.doc-xlsx td { border: 1px solid #ddd; padding: 2px 7px; white-space: nowrap; color: #222; }

.doc-pdf__page { position: relative; margin: 0 auto 14px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.doc-pdf__page canvas { display: block; }
/* PDF.js 4 text layer (transparent, sits over the canvas for selection
   and for the evidence highlighter to find text). */
.textLayer { position: absolute; inset: 0; overflow: clip; opacity: 1; line-height: 1;
  text-align: initial; transform-origin: 0 0; forced-color-adjust: none; z-index: 1; }
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre;
  transform-origin: 0 0; }
.textLayer span.markedContent { top: 0; height: 0; }

.hl-box {
  position: absolute; pointer-events: none; z-index: 4;
  background: rgba(255,224,102,.5); border: 1px solid #d99b00; border-radius: 2px;
}

.review-split__form .field-row { grid-template-columns: 210px 1fr; gap: 10px 12px; padding: 8px; border-radius: 6px; }
.review-split__form .field-row__source { grid-column: 1 / -1; }
.field-row--linked { cursor: pointer; }
.field-row--linked:hover { background: var(--lime-tint); }
.field-row.is-lit { background: var(--lime-tint); box-shadow: inset 0 0 0 1px var(--lime); }
.field-row--linked .field-row__name label::after {
  content: "\00a0\1F50D"; font-size: 12px; opacity: .5;
}
.field-row--linked:hover .field-row__name label::after,
.field-row.is-lit .field-row__name label::after { opacity: 1; }
.field-row.is-lit.is-pinned { box-shadow: inset 0 0 0 2px var(--lime); }

@media (max-width: 1000px) {
  .review-split { grid-template-columns: 1fr; }
  .review-split__doc { position: static; }
  .doc-preview { height: 520px; }
  .review-split__form .field-row { grid-template-columns: 1fr; }
}

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  padding: 10px 0 10px 18px;
  border-left: 2px solid var(--navy-40);
  position: relative;
  margin-left: 6px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -6px; top: 14px;
  width: 10px; height: 10px;
  background: var(--navy);
  border-radius: 50%;
}
.timeline__meta { font-size: 12px; color: var(--ink-soft); }
.timeline__action { font-weight: 700; color: var(--navy); }

/* ---------- Auth pages ---------- */
.auth-wrap { max-width: 420px; margin: 8vh auto 0; }
.auth-brand { text-align: center; margin-bottom: 18px; letter-spacing: .12em; font-weight: 700; font-size: 24px; }
.auth-brand .c1 { color: var(--lime-dark); }
.auth-brand .c2 { color: var(--navy); }

.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.confirm-box {
  border: 2px solid var(--lime);
  background: var(--lime-tint);
  border-radius: var(--radius);
  padding: 16px;
}
.confirm-box label { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.confirm-box input[type="checkbox"] { width: auto; margin-top: 3px; }

/* ---------- Sequential processing progress ---------- */
.proc { margin-top: 6px; }
.proc__bar {
  height: 10px;
  border-radius: 999px;
  background: var(--navy-12);
  overflow: hidden;
  margin: 10px 0 8px;
}
.proc__fill {
  height: 100%;
  width: 0;
  background: var(--lime);
  transition: width .25s ease;
}
.proc__status { font-size: 14px; font-weight: 600; color: var(--navy); }
.proc__log {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  max-height: 220px;
  overflow-y: auto;
}
.proc__log li { padding: 3px 0; border-bottom: 1px solid var(--line); }
.proc__log li.is-ok::before   { content: "✓ "; color: var(--ok); font-weight: 700; }
.proc__log li.is-fail::before { content: "✕ "; color: var(--err); font-weight: 700; }
.proc__spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--navy-40);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: proc-spin .8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes proc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .proc__spinner { animation: none; }
  .proc__fill { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .review-layout { grid-template-columns: 1fr; }
  .product-list { position: static; max-height: none; }
  .field-row { grid-template-columns: 1fr; }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .app-header__inner { padding: 10px 14px; }
  .app-main { padding: 18px 14px 44px; }
  .brandmark__tag { display: none; }
}
