/* The sign-in, sign-up and admin pages (deploy_plan.txt phase D).
 *
 * Layout after the reference the user supplied: wordmark top-left, a centred card
 * on the left, one image panel on the right, a single primary button. What is NOT
 * copied is the "Continue with Google" row — there is no OAuth provider to point
 * at, and a lone social button over an "OR" divider with one alternative is a
 * shape that promises a choice this deployment cannot offer. Email and password.
 *
 * Colours come from theme.css so this cannot drift from the tool it fronts; D15's
 * purple is the accent. Only the pieces theme.css has no opinion about live here.
 */

*, *::before, *::after { box-sizing: border-box; }

/* THE AUTH PAGES SCROLL. `theme.css` sets `html, body { height: 100%; overflow:
   hidden }` — right for BUILD and OPTIMIZE, which are fixed-viewport apps whose
   panels do their own scrolling, and wrong for a document that grows: the admin
   page's user table ran past the bottom of the window with no way to reach it.
   These pages are documents, so they get document behaviour back. */
html.auth, body.auth {
  height: auto;
  overflow: visible;
}

body.auth {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ── shell ─────────────────────────────────────────────────────────────── */

.auth-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
}

.auth-left {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 96px 32px 120px;
}

.auth-brand {
  position: absolute;
  top: 28px;
  left: 34px;
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}
.auth-brand .mark { color: var(--accent-hl); font-size: 20px; line-height: 1; }
.auth-brand b { font-weight: 600; }
.auth-brand span.dim { color: var(--text-dim); font-weight: 400; }

/* ── the two institutional marks ─────────────────────────────────────────
 * Top-left of the form column, sharing one baseline with a hairline between
 * them: the lab owns the tool and the university hosts it, which is a
 * relationship two marks side by side state better than either alone.
 * Each <img> hides itself when the file is absent and the text carries the
 * identity, so the page is never half-drawn while the logos are missing. */
.auth-marks {
  position: absolute;
  bottom: 30px;
  left: 34px;
  right: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.mark-rail, .mark-chalmers { display: flex; align-items: center; gap: 10px; }
.auth-marks img { display: block; height: 38px; width: auto; }
.mark-chalmers img { height: 30px; }
.mark-text {
  font-size: 12.5px;
  line-height: 1.28;
  color: var(--text);
  letter-spacing: .01em;
}
.mark-text b { font-weight: 600; }
.mark-text span { color: var(--text-dim); font-size: 11px; letter-spacing: .06em; }
.mark-rule { width: 1px; height: 30px; background: var(--border); }

@media (max-width: 900px) {
  .auth-marks { position: static; margin: 34px auto 0; justify-content: center; }
}

.auth-card { width: 100%; max-width: 384px; }

.auth-title {
  font-size: 40px;
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  text-align: center;
}
.auth-sub {
  margin: 0 0 34px;
  text-align: center;
  color: var(--text-dim);
  font-size: 15px;
}

.auth-box {
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 26px 24px 22px;
  background: rgba(255, 255, 255, 0.012);
}

/* ── fields ────────────────────────────────────────────────────────────── */

.auth-field { margin-bottom: 12px; }
.auth-field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.auth-field input,
.auth-field textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color .12s;
}
.auth-field textarea { resize: vertical; min-height: 62px; }
.auth-field input:focus,
.auth-field textarea:focus { border-color: var(--accent-hl); }
.auth-field input::placeholder,
.auth-field textarea::placeholder { color: var(--text-muted); }
.auth-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }

.auth-btn {
  width: 100%;
  padding: 12px 16px;
  margin-top: 6px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: #000;
  background: #fff;
  border: 1px solid #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .12s, transform .06s;
}
.auth-btn:hover { opacity: .88; }
.auth-btn:active { transform: scale(0.985); }
.auth-btn[disabled] { opacity: .5; cursor: default; transform: none; }

.auth-btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.auth-btn-ghost:hover { background: var(--bg-hover); opacity: 1; }

.auth-alt {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.auth-alt a { color: var(--accent-hl); text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

.auth-legal {
  margin-top: 14px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── messages ──────────────────────────────────────────────────────────── */

.auth-msg {
  display: none;
  margin: 0 0 14px;
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid;
}
.auth-msg.show { display: block; }
.auth-msg.error  { color: #f0b4b4; border-color: rgba(204,68,68,.45);
                   background: rgba(204,68,68,.09); }
.auth-msg.ok     { color: var(--accent-hl);
                   border-color: rgba(var(--accent-hl-rgb),.4);
                   background: rgba(var(--accent-hl-rgb),.08); }
.auth-msg.info   { color: var(--text-dim); border-color: var(--border);
                   background: var(--bg-panel); }
.auth-msg a { color: var(--accent-hl); text-decoration: none; margin-left: 10px; }
.auth-msg a:hover { text-decoration: underline; }
.auth-msg b { color: var(--text); font-weight: 500; }

/* ── the right-hand panel ──────────────────────────────────────────────── */
/* No photograph: a stock image of somebody at a desk says nothing about what this
 * tool does. The panel shows the loop itself, which is the one thing a visitor
 * standing at a login screen might actually want to know. */

.auth-right { padding: 26px 26px 26px 0; }
.auth-figure {
  height: 100%;
  min-height: 520px;
  border: 1px solid var(--border-dim);
  border-radius: 14px;
  background:
    radial-gradient(120% 90% at 78% 8%, rgba(var(--accent-hl-rgb), .10), transparent 60%),
    linear-gradient(160deg, #0c0c0e 0%, #000 62%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 46px 44px;
  overflow: hidden;
}
.auth-figure h2 {
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 26px;
  font-weight: 500;
}
.loop-step {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  padding: 13px 0;
  border-top: 1px solid var(--border-dim);
}
.loop-step:first-of-type { border-top: 0; }
.loop-step .n {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-hl);
  padding-top: 3px;
  min-width: 22px;
}
.loop-step .t { font-size: 14.5px; color: var(--text); margin-bottom: 3px; }
.loop-step .d { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.auth-figure .foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border-dim);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── the engineering sketch ──────────────────────────────────────────────
 * Line weights follow a real drawing: the object heaviest, dimension and
 * leader lines thin, hatching thinnest. That hierarchy is what makes a
 * technical drawing readable, and it is doing the same job here. */
.auth-figure { padding: 30px 26px 24px; }
.hero { width: 100%; height: auto; display: block; flex: 1; min-height: 0; }

.hero .part {
  fill: #101014;
  stroke: var(--text-dim);
  stroke-width: 2;
}
.hero .limb {
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 13;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero .limb.arm { stroke-width: 9; }
.hero .limb.back { stroke: #3a3a3a; stroke-width: 8; }
.hero .joint {
  fill: #0b0b0d;
  stroke: var(--text-dim);
  stroke-width: 2.5;
}
.hero .joint.knee { stroke: var(--accent-hl); }
.hero .visor { fill: var(--accent-hl); opacity: .85; }
.hero .pip { fill: var(--accent-hl); }

.hero .ln-ground { stroke: var(--border-bright); stroke-width: 1.5; }
.hero .hatch path { stroke: var(--border); stroke-width: 1; fill: none; }
.hero .ln-detail { stroke: #2e2e33; stroke-width: 1.5; }
.hero .ln-dim,
.hero .ln-lead {
  fill: none;
  stroke: var(--accent-hl);
  stroke-width: 1;
  stroke-opacity: .75;
}
.hero .ln-lead { stroke-dasharray: 3 3; }

.hero .t-key {
  fill: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
}
.hero .t-val {
  fill: var(--text);
  font-family: var(--mono);
  font-size: 17px;
}
.hero .t-mono {
  fill: var(--accent-hl);
  font-family: var(--mono);
  font-size: 12px;
  text-anchor: middle;
}

/* THE NUMBERS CHANGE, because that is the loop. Two stacked labels crossfade
 * rather than one being rewritten: SVG text cannot be animated by content, and
 * a crossfade reads as a revision rather than a glitch. */
.hero .swap-a, .hero .swap-b { animation: heroSwap 9s ease-in-out infinite; }
.hero .swap-b { animation-name: heroSwapB; }
@keyframes heroSwap  { 0%,42% { opacity: 1 } 50%,92% { opacity: 0 } 100% { opacity: 1 } }
@keyframes heroSwapB { 0%,42% { opacity: 0 } 50%,92% { opacity: 1 } 100% { opacity: 0 } }

.hero .knee-halo {
  fill: none;
  stroke: var(--accent-hl);
  stroke-width: 1.5;
  opacity: 0;
  animation: heroPulse 9s ease-out infinite;
}
@keyframes heroPulse {
  0%   { opacity: .55; transform: scale(.6);  transform-origin: 262px 400px; }
  22%  { opacity: 0;   transform: scale(1.3); transform-origin: 262px 400px; }
  100% { opacity: 0;   transform: scale(1.3); transform-origin: 262px 400px; }
}

/* the measurement sweep — a guess becomes a number */
.hero .scan {
  fill: var(--accent-hl);
  opacity: .18;
  animation: heroScan 9s cubic-bezier(.4,0,.2,1) infinite;
}
@keyframes heroScan {
  0%, 8%   { transform: translateY(0);    opacity: 0; }
  14%      { opacity: .3; }
  46%      { transform: translateY(372px); opacity: 0; }
  100%     { transform: translateY(372px); opacity: 0; }
}


/* Somebody who has asked their system not to animate things gets a still
 * drawing, with the revised values showing rather than a blank crossfade. */
@media (prefers-reduced-motion: reduce) {
  .hero .swap-a, .hero .swap-b, .hero .knee-halo, .hero .scan { animation: none; }
  .hero .swap-a, .hero .scan, .hero .knee-halo { opacity: 0; }
  .hero .swap-b { opacity: 1; }
}

@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-right { display: none; }
  .auth-left { padding-top: 92px; }
}

/* ── admin ─────────────────────────────────────────────────────────────── */

.admin-page { padding: 26px 30px 60px; max-width: 1180px; margin: 0 auto; }
.admin-head {
  display: flex; align-items: baseline; gap: 16px;
  padding-bottom: 16px; margin-bottom: 22px;
  border-bottom: 1px solid var(--border-dim);
}
.admin-head h1 { font-size: 19px; font-weight: 500; margin: 0; }
.admin-head .spacer { flex: 1; }
.admin-head a, .admin-head button {
  font-size: 12px; color: var(--text-dim); background: none;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 11px; cursor: pointer; text-decoration: none;
  font-family: var(--font);
}
.admin-head a:hover, .admin-head button:hover {
  color: var(--text); border-color: var(--border-bright);
}

.admin-section { margin-bottom: 34px; }
.admin-section > h2 {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim); margin: 0 0 12px; font-weight: 500;
}
.admin-count { color: var(--accent-hl); font-family: var(--mono); }

.admin-empty {
  padding: 26px; text-align: center; color: var(--text-muted);
  font-size: 13px; border: 1px dashed var(--border-dim); border-radius: 8px;
}

table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin-table th {
  text-align: left; font-weight: 500; font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted);
  padding: 0 12px 8px; border-bottom: 1px solid var(--border-dim);
}
table.admin-table td {
  padding: 12px; border-bottom: 1px solid var(--border-dim);
  vertical-align: top;
}
table.admin-table tr:hover td { background: rgba(255,255,255,.014); }
.admin-name { color: var(--text); }
.admin-email { color: var(--text-dim); font-family: var(--mono); font-size: 11.5px; }
.admin-purpose {
  color: var(--text-dim); font-size: 12.5px; line-height: 1.5;
  max-width: 380px;
}
.admin-when { color: var(--text-muted); font-size: 11.5px; white-space: nowrap; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid;
}
.pill.pending  { color: var(--orange); border-color: rgba(224,123,57,.4); }
.pill.active   { color: var(--accent-hl);
                 border-color: rgba(var(--accent-hl-rgb),.4); }
.pill.rejected,
.pill.disabled { color: var(--text-muted); border-color: var(--border); }

.admin-actions { display: flex; gap: 6px; white-space: nowrap; }
.admin-actions button {
  font-family: var(--font); font-size: 12px; padding: 6px 11px;
  border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
}
.admin-actions button:hover { color: var(--text); border-color: var(--border-bright); }
.admin-actions button.approve {
  color: var(--accent-hl); border-color: rgba(var(--accent-hl-rgb),.45);
}
.admin-actions button.approve:hover {
  background: rgba(var(--accent-hl-rgb),.1);
}
.admin-actions button[disabled] { opacity: .45; cursor: default; }

.load-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 12px;
}
.load-cell {
  border: 1px solid var(--border-dim); border-radius: 8px; padding: 14px 16px;
}
.load-cell .k {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 7px;
}
.load-cell .v { font-family: var(--mono); font-size: 19px; color: var(--text); }
.load-cell .v.hl { color: var(--accent-hl); }
.load-cell .sub { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; }

.bar { height: 4px; background: #101010; border-radius: 2px; margin-top: 9px; }
.bar > i { display: block; height: 100%; border-radius: 2px;
           background: var(--accent-hl); }
.bar > i.warn { background: var(--orange); }

/* the title block, and the small plate the on-figure dimension sits on */
.hero .tblock rect,
.hero .tblock line { fill: none; stroke: var(--border); stroke-width: 1; }
.hero .dim-plate { fill: #0b0b0d; stroke: none; }
.hero .core { fill: none; stroke: var(--accent-hl); stroke-width: 2; opacity: .8; }
.hero .part.back-part { stroke: #3a3a3a; }

/* The revised limb carries the accent, so the eye lands on the thing the loop
   is changing rather than wandering over a uniform grey machine. */
.hero .limb.lead { stroke: #6b5a80; }
.hero .part.lead-part { stroke: #6b5a80; }

/* ── the loop diagram ────────────────────────────────────────────────────
 * Geometry only — boxes, arrows and four glyphs made of circles, rectangles
 * and straight lines. Two earlier versions of this panel were figurative (a
 * robot drawn by hand, then a rendered animation); this one is a diagram,
 * because what a visitor needs at a login screen is the IDEA, and the idea is
 * a cycle. */
.hero { width: 100%; height: auto; display: block; }

.hero .node rect {
  fill: rgba(255, 255, 255, .014);
  stroke: var(--border);
  stroke-width: 1;
}
.hero .glyph {
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.hero .glyph rect { fill: none; }
.hero .glyph .hl { stroke: var(--accent-hl); }
.hero .glyph .knob { fill: #0b0b0d; }

.hero .n-num {
  fill: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
}
.hero .n-title {
  fill: var(--text);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .04em;
  text-anchor: middle;
}

.hero .flow path {
  fill: none;
  stroke: var(--accent-hl);
  stroke-width: 1.4;
  stroke-opacity: .85;
}
.hero .repeat {
  fill: var(--text-muted);
  font-family: var(--font);
  font-size: 12.5px;
  font-style: italic;
  text-anchor: middle;
}

/* One quiet pass around the cycle, so it reads as a loop rather than four
   boxes. Slow and low-contrast on purpose: this sits behind a password field
   and must not compete with it. */
.hero .flow path { stroke-dasharray: 6 5; animation: heroFlow 3.4s linear infinite; }
@keyframes heroFlow { to { stroke-dashoffset: -22; } }

@media (prefers-reduced-motion: reduce) {
  .hero .flow path { animation: none; stroke-dasharray: none; }
}

/* "updated HH:MM:SS" beside the admin controls — the signal that a refresh (or
   the automatic poll) actually happened, since the data itself usually looks
   the same either way. */
.admin-updated {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-muted);
  margin-right: 4px;
  white-space: nowrap;
}
.admin-head button[disabled] { opacity: .6; cursor: default; }
