/* portal.css — the portal's own layout. Every colour, rule, font and status chip comes from
 * tokens.css (Concept C "Engineering Register", vendored from Cortex); this file adds nothing but
 * arrangement. The page must read like the transmittals and owner packages Phil's counterparties
 * already receive — same double rule under the masthead, same mono small-caps column heads, same
 * quiet default with drafting red reserved for a real exception.
 *
 * Structure follows Cortex's app/public/portal-preview.html so the internal preview and the live
 * external page are the same object seen twice.
 *
 * NO @import, NO url(), NO font host, NO remote anything: the CSP is default-src 'none' and this
 * file must never be the reason it needs loosening. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sheet);
  color: var(--ink);
  font: 15px/1.55 var(--font-body);
}

.pwrap {
  width: 100%; max-width: 960px; margin: 0 auto;
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 48px);
}

/* ---- masthead ---------------------------------------------------------------------------- */
.mast { border-bottom: 3px double var(--ink); padding: 16px 0 10px; margin-bottom: 10px; }
.mast .row { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 8px; }
.mast .co {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase; color: var(--steel);
}
.mast h1 { font-family: var(--cond); font-size: 28px; line-height: 1.15; font-weight: 600; margin: 5px 0 2px; }
.mast .sub { color: var(--steel); font-size: 13px; }
.asof { font-family: var(--font-mono); font-size: 11px; color: var(--steel); text-align: right; line-height: 1.7; }
.asof b { color: var(--ink); }

/* ---- the staleness banner ---------------------------------------------------------------------
 * Accent-outlined, not solid: this is "look at this", not "something is broken". The data is real,
 * it is just older than a day, and the page says exactly how old rather than implying freshness. */
.banner {
  background: var(--accent-tint); border: 1px solid var(--accent); color: var(--accent);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em;
  padding: 7px 10px; margin: 10px 0 0; text-align: center;
}
.banner[hidden] { display: none; }

/* ---- tabs ------------------------------------------------------------------------------------- */
.tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--hairline);
  overflow-x: auto; margin: 14px 0 18px; -webkit-overflow-scrolling: touch;
}
.tabs .tab {
  appearance: none; -webkit-appearance: none; background: transparent; border: 0;
  border-bottom: 2px solid transparent; border-radius: 0; cursor: pointer;
  font: 600 12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--steel); padding: 10px 11px; white-space: nowrap; min-height: 40px;
}
.tabs .tab.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.panel[hidden] { display: none; }
.panel h2 {
  display: flex; align-items: baseline; gap: 8px; margin: 0 0 9px; padding: 0 0 5px;
  border-bottom: 1px solid var(--hairline); font-family: var(--cond); font-size: 19px; font-weight: 600;
}
.pending { color: var(--steel); font-size: 13px; padding: 12px 0; }

/* ---- key cards --------------------------------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.kcard { background: var(--paper); border: 1px solid var(--hairline); padding: 9px 10px; }
.kcard .k {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--steel);
}
.kcard .v { font-family: var(--cond); font-size: 21px; margin-top: 2px; }

/* ---- registers --------------------------------------------------------------------------------- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.reg {
  width: 100%; border-collapse: collapse; background: var(--paper);
  border: 1px solid var(--hairline); font-size: 13px;
}
table.reg th {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--steel); text-align: left; padding: 6px 8px;
  border-bottom: 2px solid var(--ink); background: var(--vellum); white-space: nowrap;
}
table.reg td { padding: 6px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
table.reg tbody tr:last-child td { border-bottom: none; }
table.reg td.num, table.reg th.num { text-align: right; font-family: var(--font-mono); font-size: 12px; }

/* ---- honest empty states ------------------------------------------------------------------------
 * Dashed, quiet, and always carrying the bundle's own `awaiting` sentence: a granted-but-empty
 * surface says what it is waiting for rather than pretending it does not exist. */
.pempty {
  background: var(--paper); border: 1px dashed var(--rule); padding: 14px;
  color: var(--steel); font-size: 13.5px; text-align: center;
}
.pempty p { margin: 0 0 8px; }
.pempty p:last-child { margin-bottom: 0; }
.pnote { font-size: 12px; color: var(--steel); margin-top: 7px; line-height: 1.6; }

/* The "internal working figures" label. Accent-outlined so it cannot be skimmed past: it marks a
 * number that is a working figure, not a released or contracted one. */
.working {
  border: 1px solid var(--accent); color: var(--accent); background: var(--accent-tint);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em;
  padding: 6px 9px; margin: 0 0 9px;
}

/* ---- activity feed ------------------------------------------------------------------------------ */
.feed { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--hairline); }
.feed li { display: flex; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--hairline); font-size: 13px; }
.feed li:last-child { border-bottom: none; }
.feed .ts { font-family: var(--font-mono); font-size: 11px; color: var(--steel); white-space: nowrap; min-width: 86px; }

/* ---- gate / enrollment / re-auth cards ------------------------------------------------------------ */
.card { background: var(--paper); border: 1px solid var(--hairline); padding: 16px; margin: 16px 0; }
.card h2 { font-family: var(--cond); font-size: 20px; font-weight: 600; margin: 0 0 8px; }
.card p { margin: 0 0 10px; font-size: 14px; }
.muted { color: var(--steel); font-size: 13px; }
.field { margin: 12px 0; }
.field label {
  display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--steel); margin-bottom: 4px;
}
.field input {
  width: 100%; min-height: 42px; padding: 9px 10px; border: 1px solid var(--rule); border-radius: 0;
  background: var(--paper); color: var(--ink); font: 16px var(--font-mono);
}
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.act {
  appearance: none; -webkit-appearance: none; border: 1px solid var(--ink); border-radius: 0;
  background: var(--ink); color: var(--paper); cursor: pointer; min-height: 42px; padding: 10px 16px;
  font: 600 12px var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
}
.act[disabled] { opacity: .55; cursor: default; }
.msg { margin-top: 10px; font-size: 13px; color: var(--accent); min-height: 1.2em; }
.msg.ok { color: var(--ink); }

.signout { margin-top: 22px; }
.link {
  appearance: none; -webkit-appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
  font: 600 11px var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--steel); text-decoration: underline;
}

/* ---- footer ---------------------------------------------------------------------------------------- */
.pfoot {
  border-top: 3px double var(--ink); margin-top: 28px; padding-top: 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--steel);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px;
}

@media (max-width: 560px) {
  .mast .row { flex-direction: column; align-items: flex-start; }
  .asof { text-align: left; }
  .mast h1 { font-size: 24px; }
}
