/* MARKSMAN Growth shell. Tokens live in ../src/brand/tokens.css. */

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h2 { font-size: 20px; letter-spacing: -.4px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .2px; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

svg.icon {
  width: 18px; height: 18px; stroke: currentColor; fill: none;
  stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}

/* Fixed, not absolute: an absolutely positioned link parked at top:-48px sits
   above the document, and focusing it scrolls the page instead of revealing it. */
.skip {
  position: fixed; left: 8px; top: -48px; z-index: 30;
  background: var(--ink); color: #fff; padding: 10px 14px;
  border-radius: var(--radius); transition: top .12s;
}
.skip:focus { top: 8px; }
@media (prefers-reduced-motion: reduce) { .skip { transition: none; } }

/* ---------- layout ---------- */
/* minmax(0, 1fr) rather than 1fr: an fr column takes its content's min-content
   size as its floor, so the nav row and the 560px table would widen the column
   and scroll the whole page sideways. */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  min-width: 0;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand__mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--orange);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { letter-spacing: -.3px; }
.brand__product { font-size: 11px; color: var(--muted); }

.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--grey);
}
.nav__item:hover { background: var(--subtle); color: var(--ink); }
.nav__item.is-active { background: var(--orange-light); color: var(--accent); font-weight: 650; }
/* A view that is not connected is marked in the nav, before it is opened. */
.nav__flag { margin-left: auto; color: var(--muted2); font-size: 18px; line-height: 1; }
.sidebar__foot { margin-top: auto; color: var(--muted2); padding: 0 6px; }

.main {
  padding: 26px 28px 80px; display: flex; flex-direction: column; gap: 22px; outline: none;
  /* A grid item defaults to min-width:auto, so the 560px-wide table would push
     this column past the viewport and scroll the whole page sideways. Wide
     content must scroll inside .table__scroll, never the body. */
  min-width: 0;
}
.main:focus-visible { outline: 3px solid #ea5e2770; outline-offset: -3px; }
.section__head { display: flex; flex-direction: column; gap: 4px; }

/* ---------- data ---------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.metric {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.metric__value { font-size: 24px; letter-spacing: -.5px; color: var(--ink); }
.metric__label { margin-top: 2px; font-weight: 650; }
.metric__note { font-size: 11px; margin-top: 3px; }

.table__scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 650; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--subtle); }
.pager { font-size: 11px; }
.warning {
  background: var(--orange-light); border: 1px solid #ea5e2733;
  border-radius: var(--radius); padding: 10px 14px; color: var(--accent);
}

/* ---------- view states ----------
   Distinct colour, icon and wording per state. Corte A's acceptance criterion is
   that an API error never reads as zero records, so these must not converge. */
.state {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 22px; display: flex; flex-direction: column; gap: 8px;
}
.state__head { display: flex; align-items: center; gap: 9px; }
.state__title { font-size: 14px; }
.state__body { max-width: 62ch; color: var(--grey); }
.state__detail { color: var(--muted); }

.state--empty { border-style: dashed; color: var(--state-empty); }
.state--empty .state__title { color: var(--ink); }
.state--error { border-color: #a7434344; background: var(--state-error-bg); }
.state--error .state__head { color: var(--state-error); }
.state--unauthorized { border-color: #4c638744; background: var(--state-unauthorized-bg); }
.state--unauthorized .state__head { color: var(--state-unauthorized); }

.state--loading { gap: 10px; }
.skeleton__bar {
  height: 13px; border-radius: 6px; background: var(--cloud);
  animation: pulse 1.3s ease-in-out infinite;
}
.skeleton__bar:nth-child(3) { width: 72%; }
.skeleton__bar:nth-child(4) { width: 45%; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .skeleton__bar { animation: none; } }

.framed { display: flex; flex-direction: column; gap: 8px; }
.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 12px; border-radius: 9px; font-size: 12px;
}
.banner--fresh { color: var(--muted); padding-left: 2px; }
.banner--loading { color: var(--muted); padding-left: 2px; }
/* Stale is valid data with an age warning, not a failure. It must not look like
   .state--error, and it must not look like nothing happened either. */
.banner--stale {
  background: var(--state-stale-bg); color: var(--state-stale);
  border: 1px solid #ea5e2733; font-weight: 650;
}
.banner__code { opacity: .8; font-weight: 400; }

/* ---------- readiness disclosure ---------- */
.disclosure {
  display: flex; flex-direction: column; gap: 3px;
  border-radius: var(--radius); padding: 12px 14px; border: 1px solid;
}
.disclosure strong { letter-spacing: .3px; }
.disclosure__note { font-size: 12px; }
.disclosure--prototype { background: var(--blue-light); border-color: #4c638733; color: var(--blue); }
.disclosure--unbuilt { background: var(--subtle); border-color: var(--line); color: var(--grey); }
.disclosure--local { background: var(--subtle); border-color: var(--line); color: var(--muted); }

/* ---------- design mode ---------- */
.faultbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 16px; background: var(--ink); color: var(--cloud);
  border-top: 3px solid var(--orange);
}
.faultbar__tag { color: var(--orange); letter-spacing: 1.2px; font-size: 11px; font-family: var(--mono); }
.faultbar__note { font-size: 12px; color: #cfcfca; }
.faultbar__control { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.faultbar select {
  background: #2a2a2a; color: var(--cloud); border: 1px solid #4a4a4a;
  border-radius: 7px; padding: 5px 8px;
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    flex-direction: row; align-items: center; gap: 12px;
    overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line);
    padding: 12px; position: sticky; top: 0; z-index: 5;
  }
  .nav { flex-direction: row; gap: 4px; min-width: 0; }
  .nav__item { white-space: nowrap; padding: 8px 12px; }
  .nav__item span:not(.nav__flag) { display: none; }
  .nav__item.is-active span:not(.nav__flag) { display: inline; }
  .sidebar__foot { display: none; }
  .main { padding: 18px 14px 96px; }
  .faultbar__control { margin-left: 0; width: 100%; }
}


/* ---------- detail view ---------- */
.linklike {
  background: none; border: 0; padding: 0; color: var(--accent);
  font: inherit; text-align: left; cursor: pointer; border-radius: 4px;
}
.linklike:hover { text-decoration: underline; }
.back { margin-bottom: 2px; font-size: 12px; }
.preview-link { margin-top: 4px; font-size: 12px; align-self: flex-start; }

.detail { display: flex; flex-direction: column; gap: 16px; }
.detail__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail__sub { margin-top: 4px; }
.notice {
  background: var(--subtle); border: 1px solid var(--line); border-left: 3px solid var(--orange);
  border-radius: var(--radius); padding: 10px 14px; color: var(--grey); max-width: 72ch;
}
.small { font-size: 11px; }

.meta {
  display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px;
  margin: 0; padding: 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.meta dt { color: var(--muted); font-size: 12px; }
.meta dd { margin: 0; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 650; letter-spacing: .2px; border: 1px solid transparent;
}
.badge--neutral { background: var(--cloud); color: var(--grey); }
.badge--info { background: var(--blue-light); color: var(--blue); border-color: #4c638733; }
.badge--positive { background: var(--green-light); color: var(--green); border-color: #28725833; }
.badge--muted { background: var(--subtle); color: var(--muted); }
.badge--danger { background: var(--red-light); color: var(--red); border-color: #a7434333; }

.messages { display: flex; flex-direction: column; gap: 10px; }
.message {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.message__head { display: flex; align-items: center; gap: 10px; }
.message__meta { color: var(--muted); }
.message__subject { font-size: 13px; }
.message__body { color: var(--grey); white-space: pre-wrap; }
.strong { font-weight: 650; }

/* ---------- live mode ---------- */
/* #app keeps its .app grid; the gate must span both columns, not sit in the
   222px sidebar column. */
.login-gate { grid-column: 1 / -1; display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 32px; max-width: 380px; width: 100%;
  display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { font-size: 24px; letter-spacing: -.5px; margin: 0; }
.eyebrow { font: 10px/1.4 var(--mono); letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); }
.google-sign-in {
  margin-top: 8px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--ink); color: #fff; font-weight: 650;
}
.google-sign-in:hover { background: #000; }
.google-sign-in:disabled { opacity: .5; }
.login-error { color: var(--red); font-size: 12px; min-height: 1em; }

.sessionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: var(--green); color: #fff;
}
.sessionbar__tag { font: 11px/1 var(--mono); letter-spacing: 1.2px; }
.sessionbar__who { font-size: 12px; opacity: .9; }
.sessionbar button {
  margin-left: auto; background: rgba(255,255,255,.16); color: #fff;
  border: 1px solid rgba(255,255,255,.3); border-radius: 7px; padding: 5px 10px; font-size: 12px;
}
