/* ================================================================
   RECAI Labs — client portal
   Inherits the homepage direction ("precision laboratory"): cool
   near-white paper, disciplined grid, mono details, rust accent.
   Tokens are redeclared rather than imported from styles.css so the
   portal can be deployed or restyled without touching the marketing
   site's stylesheet.
   ================================================================ */

:root {
  --paper: #DADEE3;
  --ink: #0C1220;
  --slate: #4E586B;
  --rust: #A93E0F;
  --signal: var(--rust);
  --signal-deep: #8A3009;
  --hairline: #C2C8D2;
  --hairline-dark: #232B3D;
  --paper-dim: #C9D0DD;
  --card: #E8EBEF;

  /* Status colours. Each is darkened enough to hold 4.5:1 on both
     --paper and --card, so status text never needs a special case. */
  --ok: #1E6B3A;
  --warn: #8A5A00;
  --stop: #A3231B;

  --font-display: "Archivo", sans-serif;
  --font-body: "Instrument Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --container: 1140px;
  --pad-x: 32px;
}

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

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

a { color: var(--ink); text-decoration: none; text-underline-offset: 4px; text-decoration-color: var(--signal); }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--pad-x); }

/* ---- Auth pages ------------------------------------------------ */

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

/* The dark band echoes the homepage's single dark section. It is
   decorative only — everything it says is repeated in the form column,
   so collapsing it on narrow screens loses no information. */
.auth-aside {
  background: var(--ink);
  color: var(--paper);
  padding: 56px var(--pad-x);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-aside .wordmark { color: var(--paper); font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.14em; }
.auth-aside h1 { font-family: var(--font-display); font-size: clamp(28px, 3vw, 40px); line-height: 1.15; font-weight: 600; max-width: 15ch; }
.auth-aside p { color: #A7B0C0; margin-top: 16px; max-width: 38ch; }
.auth-aside footer { font-family: var(--font-mono); font-size: 12px; color: #7C879A; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 56px var(--pad-x); }
.auth-card { width: 100%; max-width: 420px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 12px;
}

.auth-card h2 { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.2; }
.auth-card .lede { color: var(--slate); margin-top: 8px; }

/* ---- Forms ------------------------------------------------------ */

.field { margin-top: 22px; }

.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }

.field .hint { display: block; font-size: 13px; color: var(--slate); font-weight: 400; margin-top: 2px; }

.field input {
  width: 100%;
  padding: 11px 13px;
  font-family: var(--font-body);
  font-size: 16px; /* 16px minimum stops iOS Safari zooming on focus. */
  color: var(--ink);
  background: #F1F3F6;
  border: 1px solid var(--hairline);
  border-radius: 2px;
}

.field input:focus-visible { border-color: var(--signal); outline-offset: 1px; }
.field input[aria-invalid="true"] { border-color: var(--stop); }

/* Errors are announced to screen readers via aria-live in the markup,
   and marked with a leading rule rather than colour alone. */
.field-error { color: var(--stop); font-size: 14px; margin-top: 6px; }
.field-error:empty { display: none; }

.btn {
  display: inline-block;
  width: 100%;
  margin-top: 26px;
  padding: 12px 20px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  background: var(--signal);
  border: 1px solid var(--signal);
  border-radius: 2px;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--signal-deep); border-color: var(--signal-deep); text-decoration: none; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

.btn-quiet { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn-quiet:hover { background: var(--paper-dim); border-color: var(--slate); }

.form-foot { margin-top: 22px; font-size: 15px; color: var(--slate); }
.form-foot a { text-decoration: underline; text-decoration-color: var(--signal); }

.alt-action { margin-top: 10px; font-size: 15px; }

/* ---- Notices ---------------------------------------------------- */
/* Bordered on the left rather than distinguished by fill colour alone,
   so the kind of notice survives greyscale and colour-blind viewing. */

.notice {
  margin-top: 20px;
  padding: 12px 14px;
  border-left: 3px solid var(--slate);
  background: var(--card);
  font-size: 15px;
}
.notice-error { border-left-color: var(--stop); }
.notice-ok { border-left-color: var(--ok); }
.notice[hidden] { display: none; }

/* Demo-mode strip. Sized to be read and moved past — a full notice card
   competed with the page title for first attention, which is backwards
   for a caveat. */
.demo-strip {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 34px;
  padding: 9px 14px;
  border-left: 3px solid var(--stop);
  background: var(--card);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--slate);
}
.demo-strip[hidden] { display: none; }
.demo-strip code { font-family: var(--font-mono); font-size: 12.5px; }

.demo-tag {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: var(--stop);
  padding: 2px 7px;
  border-radius: 2px;
}

/* ---- Portal chrome ---------------------------------------------- */

.portal-header {
  border-bottom: 1px solid var(--hairline);
  background: var(--card);
}
.portal-header .bar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}
.portal-header .wordmark { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.14em; }
.portal-nav { display: flex; gap: 20px; margin-left: auto; font-size: 15px; align-items: center; }
.portal-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--signal); }

.who { font-size: 14px; color: var(--slate); text-align: right; line-height: 1.3; }
.who strong { display: block; color: var(--ink); font-weight: 500; }

.portal-main { padding: 44px 0 96px; }
.portal-main h1 { font-family: var(--font-display); font-size: 32px; font-weight: 600; }
.portal-main .lede { color: var(--slate); margin-top: 6px; }

.section { margin-top: 44px; }
.section > h2 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 18px; }

.card { background: var(--card); border: 1px solid var(--hairline); border-radius: 2px; padding: 18px; }
.card h3 { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.card p { font-size: 15px; color: var(--slate); margin-top: 6px; }

.meta { font-family: var(--font-mono); font-size: 12px; color: var(--slate); letter-spacing: 0.04em; }

/* Status pill: dot + word, never colour alone. */
.status { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--slate); }
.status-active::before { background: var(--ok); }
.status-paused::before, .status-scoping::before, .status-proposed::before { background: var(--warn); }
.status-cancelled::before { background: var(--stop); }
.status-complete::before { background: var(--ink); }

/* Progress bar. role="progressbar" in the markup carries the value for
   assistive tech; this is only the visual half. */
.progress { height: 6px; background: var(--paper-dim); border-radius: 3px; overflow: hidden; margin-top: 14px; }
.progress > span { display: block; height: 100%; background: var(--signal); }

.empty { margin-top: 18px; padding: 28px; border: 1px dashed var(--hairline); border-radius: 2px; text-align: center; color: var(--slate); }

.skeleton { color: var(--slate); font-family: var(--font-mono); font-size: 13px; margin-top: 18px; }

/* ---- Responsive -------------------------------------------------- */

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  /* Decorative only, and its content is duplicated in the form column. */
  .auth-aside { display: none; }
  .auth-main { padding: 40px 20px; min-height: 100vh; }
  :root { --pad-x: 20px; }
  .portal-header .bar { height: auto; padding: 14px 0; flex-wrap: wrap; gap: 12px; }
  .portal-nav { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .who { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
