/* Dorsan filter validation portal
   Palette reads off filtration hardware: petrol-navy housings, sky-blue flow,
   teal filtrate, amber hold. Type is IBM Plex — condensed for structural labels,
   mono for anything an engineer would read off an instrument. */

:root {
  --ink: #0C1A24;
  --ink-soft: #16303E;
  --slate: #24404F;
  --steel: #6B8391;
  --line: #CBD5DA;
  --line-soft: #E1E7EA;
  --paper: #E9EDEF;
  --card: #FFFFFF;

  --flow: #0F7EA8;
  --flow-deep: #0A5E7E;
  --filtrate: #1B8F7F;
  --hold: #B87514;
  --reject: #A83A31;

  --shadow: 0 1px 2px rgba(12, 26, 36, .06), 0 8px 24px -12px rgba(12, 26, 36, .22);
  --radius: 3px;

  --sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --cond: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* Class rules below set display: grid/flex, which would otherwise beat the
   browser's own [hidden] rule and leave hidden panels on screen. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
a { color: var(--flow-deep); }

.eyebrow {
  font-family: var(--cond);
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--steel);
  margin: 0 0 .35rem;
}

.mono { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--steel); }
.small { font-size: .82rem; }

/* ---------- sign in ---------- */

.gate { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 100vh; }

.gate-art {
  position: relative;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 4rem;
  overflow: hidden;
}

/* the flow line: a single pipe running the height of the panel */
.gate-line {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--flow) 15%, var(--filtrate) 85%, transparent);
  opacity: .5;
}
.gate-line::before,
.gate-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--flow);
}
.gate-line::before { left: 18%; }
.gate-line::after { left: 74%; background: var(--filtrate); }

.gate-mark { position: relative; z-index: 1; }
.gate-mark-top {
  display: block;
  font-family: var(--cond);
  letter-spacing: .3em;
  text-transform: uppercase;
  font-size: .8rem;
  color: var(--flow);
  margin-bottom: 1rem;
}
.gate-mark-main {
  display: block;
  font-family: var(--cond);
  font-weight: 700;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: .95;
  letter-spacing: -.02em;
}
.gate-mark-sub {
  display: block;
  margin-top: 1.5rem;
  max-width: 24rem;
  color: #9FB4BF;
  font-size: .95rem;
}

.gate-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.gate-form form { width: min(22rem, 100%); }
.gate-form h1 { margin-bottom: 1.75rem; }

label {
  display: block;
  font-family: var(--cond);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .72rem;
  color: var(--slate);
  margin: 1rem 0 .3rem;
}

input, select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-family: var(--sans);
  font-size: .95rem;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--flow);
  outline-offset: 1px;
  border-color: var(--flow);
}
textarea { min-height: 5rem; resize: vertical; }
input.mono-input { font-family: var(--mono); }

.form-error {
  margin: .8rem 0 0;
  padding: .5rem .7rem;
  border-left: 3px solid var(--reject);
  background: #FAEDEC;
  color: #7A2A23;
  font-size: .88rem;
}

/* ---------- buttons ---------- */

.btn {
  font-family: var(--cond);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: .8rem;
  padding: .5rem .9rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--line-soft);
  color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--line); }
.btn:focus-visible { outline: 2px solid var(--flow); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--flow); color: #fff; }
.btn-primary:hover { background: var(--flow-deep); }
.btn-approve { background: var(--filtrate); color: #fff; }
.btn-approve:hover { background: #146C60; }
.btn-danger { background: var(--reject); color: #fff; }
.btn-danger:hover { background: #8C2E27; }
.btn-outline { background: transparent; border-color: var(--line); }
.btn-outline:hover { background: var(--line-soft); }
.btn-ghost { background: transparent; color: #9FB4BF; }
.btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-block { width: 100%; margin-top: 1.5rem; }
.btn-sm { padding: .35rem .6rem; font-size: .72rem; }

.icon-btn {
  background: none; border: 0; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: var(--steel);
}

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: 15rem 1fr; min-height: 100vh; }

.rail {
  background: var(--ink);
  color: #C3D2DA;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; gap: .7rem; align-items: center; padding: 0 1.25rem 1.5rem; }
.brand-mark {
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  background: var(--flow);
  color: #fff;
  font-family: var(--cond); font-weight: 700; font-size: .9rem;
  letter-spacing: .04em;
  border-radius: var(--radius);
}
.brand-text {
  font-family: var(--cond); font-weight: 700;
  font-size: .9rem; line-height: 1.05; color: #fff;
  text-transform: uppercase; letter-spacing: .08em;
}

.nav { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.nav button {
  text-align: left;
  background: none; border: 0; cursor: pointer;
  color: #9FB4BF;
  padding: .6rem 1.25rem;
  font-family: var(--sans); font-size: .92rem;
  border-left: 3px solid transparent;
}
.nav button:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav button[aria-current="page"] {
  background: rgba(15,126,168,.16);
  border-left-color: var(--flow);
  color: #fff;
}

.rail-foot { padding: 1rem 1.25rem 0; border-top: 1px solid rgba(255,255,255,.09); }
.who { font-size: .82rem; margin-bottom: .6rem; }
.who strong { display: block; color: #fff; font-size: .9rem; }

.view { padding: 2rem 2.5rem 4rem; max-width: 76rem; }
.view:focus { outline: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }

/* ---------- cards & tables ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .9rem; }

/* ---------- collapsible sections (fewer things visible at once) ---------- */

.section {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  margin: 1rem 0;
  overflow: hidden;
}
.section > summary {
  list-style: none;
  cursor: pointer;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  font-family: var(--cond);
  font-weight: 600;
  background: var(--paper);
  user-select: none;
}
.section > summary::-webkit-details-marker { display: none; }
.section > summary::after {
  content: "+";
  font-family: var(--mono);
  font-weight: 400;
  color: var(--steel);
  font-size: 1.1rem;
  line-height: 1;
}
.section[open] > summary::after { content: "\2212"; }
.section[open] > summary { border-bottom: 1px solid var(--line-soft); }
.section-body { padding: 1rem; }
.section-hint { font-weight: 400; font-family: var(--sans); color: var(--steel); font-size: .82rem; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  text-align: left;
  font-family: var(--cond);
  font-weight: 600; text-transform: uppercase;
  letter-spacing: .09em; font-size: .7rem;
  color: var(--steel);
  padding: .5rem .6rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: .6rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #F4F7F8; }

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--steel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty strong { display: block; color: var(--ink); margin-bottom: .3rem; }

/* ---------- stage rail: the signature element ----------
   Seven ports on a single line. Everything upstream of the current stage is
   filled; everything downstream is dimmed. Order carries real meaning here —
   a stage cannot be opened until the one before it closes. */

.flowline { position: relative; margin: 1.5rem 0 2rem; padding-top: .25rem; }
.flowline-track {
  position: absolute; left: 0; right: 0; top: 1.05rem;
  height: 2px; background: var(--line);
}
.flowline-fill {
  position: absolute; left: 0; top: 1.05rem;
  height: 2px; background: var(--flow);
  transition: width .4s ease;
}
.flowline-nodes { position: relative; display: flex; justify-content: space-between; }
.node { text-align: center; flex: 1; }
.node-dot {
  width: 14px; height: 14px; margin: .4rem auto .5rem;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
  position: relative;
}
.node.done .node-dot { background: var(--flow); border-color: var(--flow); }
.node.here .node-dot { background: #fff; border-color: var(--flow); border-width: 3px; }
.node.here .node-dot::after {
  content: ""; position: absolute; inset: -7px;
  border: 1px solid var(--flow); border-radius: 50%; opacity: .5;
  animation: ping 2.4s ease-out infinite;
}
.node.blocked .node-dot { border-style: dashed; }
@keyframes ping {
  0% { transform: scale(.7); opacity: .7; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .node.here .node-dot::after { animation: none; opacity: .5; }
  .flowline-fill { transition: none; }
}
.node-index {
  font-family: var(--mono); font-size: .68rem; color: var(--steel);
}
.node.done .node-index, .node.here .node-index { color: var(--flow-deep); }
.node-label {
  font-family: var(--cond); font-weight: 600;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--steel);
}
.node.here .node-label { color: var(--ink); }
.node.clickable { cursor: pointer; }
.node.clickable:hover .node-label { color: var(--flow-deep); }
.node.clickable:hover .node-dot { border-color: var(--flow); }
.node.clickable:focus-visible { outline: 2px solid var(--flow); outline-offset: 2px; border-radius: 4px; }

/* ---------- status chips ---------- */

.chip {
  display: inline-block;
  font-family: var(--cond); font-weight: 600;
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  padding: .18rem .45rem;
  border-radius: 2px;
  border: 1px solid;
  white-space: nowrap;
}
.chip-flow { color: var(--flow-deep); border-color: #A8CFDF; background: #E7F3F8; }
.chip-pass { color: var(--filtrate); border-color: #A5D8D0; background: #E6F5F2; }
.chip-hold { color: var(--hold); border-color: #E4C593; background: #FBF2E3; }
.chip-fail { color: var(--reject); border-color: #E2B0AB; background: #FAEDEC; }
.chip-idle { color: var(--steel); border-color: var(--line); background: var(--line-soft); }

/* ---------- your-move panel ---------- */

.move {
  border: 1px solid var(--flow);
  border-left-width: 4px;
  background: linear-gradient(180deg, #F2F9FC, #fff 60%);
}
.move .card-head h2 { color: var(--flow-deep); }
.locked { border-left: 4px solid var(--line); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem 1.5rem; }
.fact-label {
  font-family: var(--cond); font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; font-size: .68rem; color: var(--steel);
}
.fact-value { font-size: .95rem; }

/* stage counters on the dashboard */
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; }
.counter {
  background: var(--card); border: 1px solid var(--line-soft);
  border-top: 3px solid var(--flow);
  border-radius: var(--radius); padding: .9rem;
  cursor: pointer; text-align: left; width: 100%;
  font-family: inherit;
}
.counter:hover { border-color: var(--flow); }
.counter-num { font-family: var(--mono); font-size: 1.7rem; font-weight: 500; line-height: 1; }
.counter-num.zero { color: var(--line); }
.counter-label {
  font-family: var(--cond); font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; font-size: .7rem; color: var(--steel); margin-top: .4rem;
}

.filters { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.filters label { margin: 0 0 .25rem; }
.filters > div { display: flex; flex-direction: column; }
.filters input, .filters select { width: auto; min-width: 12rem; }

.report-body {
  font-family: var(--mono); font-size: .8rem; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  background: #F7F9FA; border: 1px solid var(--line-soft);
  padding: 1.25rem; border-radius: var(--radius);
  max-height: 34rem; overflow: auto;
}

.timeline { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.timeline li { padding: .5rem 0 .5rem 1rem; border-left: 2px solid var(--line-soft); position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: .95rem;
  width: 8px; height: 8px; border-radius: 50%; background: var(--line);
}
.timeline li:first-child::before { background: var(--flow); }

/* ---------- modal & toast ---------- */

.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(12,26,36,.55);
  display: grid; place-items: center; padding: 1.5rem;
}
.modal-panel {
  background: var(--card); border-radius: var(--radius);
  width: min(40rem, 100%); max-height: 86vh; overflow: auto;
  padding: 1.5rem; box-shadow: 0 24px 60px -20px rgba(0,0,0,.5);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  z-index: 60; padding: .7rem 1.1rem; border-radius: var(--radius);
  background: var(--ink); color: #fff; font-size: .9rem;
  box-shadow: var(--shadow); max-width: 90vw;
}
.toast.bad { background: var(--reject); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .gate { grid-template-columns: 1fr; }
  .gate-art { padding: 2.5rem 1.5rem; min-height: 14rem; }
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .75rem 1rem; gap: .5rem; }
  .brand { padding: 0 1rem 0 0; }
  .nav { flex-direction: row; flex: 1 1 100%; overflow-x: auto; }
  .nav button { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; padding: .5rem .75rem; }
  .nav button[aria-current="page"] { border-left-color: transparent; border-bottom-color: var(--flow); }
  .rail-foot { border-top: 0; padding: 0; display: flex; align-items: center; gap: .75rem; }
  .who { margin: 0; }
  .view { padding: 1.25rem 1rem 3rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .node-label { display: none; }
  table { font-size: .84rem; }
}

/* ---------- public intake form (no sign-in, opens straight from a link) ---------- */

.public-page {
  min-height: 100%;
  background: var(--paper);
  padding: 2.5rem 1.25rem 5rem;
  display: flex;
  justify-content: center;
}
.public-sheet {
  width: min(46rem, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.25rem 2.5rem;
}
.public-brand {
  font-family: var(--cond);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--flow-deep);
  font-size: 1.1rem;
  margin-bottom: .25rem;
}
.public-sheet h1 {
  font-size: 1.5rem;
  border-bottom: 2px solid var(--ink);
  padding-bottom: .6rem;
  margin-bottom: .3rem;
}
.public-meta { color: var(--steel); font-size: .88rem; margin-bottom: 1.5rem; }

/* Table rows mimicking the source document's own layout: a bordered box with
   label | value rows, section by section — not floating labels above inputs. */
.doc-section-title {
  font-family: var(--cond);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .82rem;
  color: var(--ink-soft);
  margin: 1.75rem 0 .5rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--line);
}
.doc-section-title:first-of-type { margin-top: 1rem; }
table.doc-table { width: 100%; border: 1px solid var(--line); border-collapse: collapse; margin-bottom: .25rem; }
table.doc-table td { border: 1px solid var(--line); padding: 0; vertical-align: middle; }
table.doc-table td.doc-label {
  width: 38%;
  background: var(--paper);
  font-weight: 600;
  font-size: .87rem;
  padding: .55rem .75rem;
}
table.doc-table td.doc-value { padding: 0; }
table.doc-table td.doc-value input,
table.doc-table td.doc-value select,
table.doc-table td.doc-value textarea {
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: .55rem .75rem;
  font-size: .87rem;
  background: transparent;
}
table.doc-table td.doc-value input:focus,
table.doc-table td.doc-value select:focus,
table.doc-table td.doc-value textarea:focus { background: #fff; outline: 2px solid var(--flow); outline-offset: -2px; }
.doc-hint { color: var(--steel); font-size: .8rem; margin: .2rem 0 .75rem; }
.public-done {
  text-align: center;
  padding: 3rem 1rem;
}
.public-done .mark { font-size: 2.5rem; color: var(--filtrate); margin-bottom: .75rem; }

@media (max-width: 640px) {
  .public-sheet { padding: 1.5rem 1.1rem 2rem; }
  table.doc-table td.doc-label { width: 44%; }
}

@media print {
  .rail, .page-head .btn, .move, .filters { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .card { box-shadow: none; border: 0; }
  .report-body { max-height: none; border: 0; background: none; }
}
