/* GlobalGigID HQ extra styles on top of luci-shell.css + look.css */
[hidden] {
  display: none !important;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

/* Desktop and tablet (>480px) base typography; phone bump (+3px) strictly at <=480px */
:root {
  --fs-small: 12px;
  --fs-body: 15px;
  --fs-h2: 24px;
  --fs-h1: 34px;
  --fs-kpi: 28px;
  --tap: 40px;
}

@media (max-width: 480px) {
  :root {
    --fs-small: 15px;
    --fs-body: 18px;
    --fs-h2: 24px;
    --fs-h1: 32px;
    --fs-kpi: 32px;
    --tap: 48px;
  }
}

h1,
.h-title {
  font-family: var(--display);
  font-size: var(--fs-h1);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--display);
  font-size: var(--fs-h2);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--display);
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--s1); }
.mt-2 { margin-top: var(--s2); }
.mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); }
.mt-5 { margin-top: var(--s5); }
.mb-2 { margin-bottom: var(--s2); }
.grid-mt-0 { margin-top: 0; }
.max-w-prose { max-width: 72ch; }
.w-full { width: 100%; }

.list-spaced {
  padding-left: 20px;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-compact {
  padding-left: 20px;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flex-wrap-gap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.banner-alert {
  border-color: var(--accent);
  background: var(--surface);
}

.card-subtle {
  background: var(--bg);
}

.hq {
  grid-template-rows: auto 1fr;
}

.hq,
.hq-main,
.hq-grid,
.hq-grid > *,
.card,
.kpis > * {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 480px) {
  .kpis {
    grid-template-columns: 1fr;
  }
}

.hq-side {
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.hq-side .brand-link {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  margin-bottom: var(--s2);
  text-decoration: none;
  color: var(--text);
}

.hq-side .brand-link img {
  height: 34px;
  width: auto;
  display: block;
}

.hq-side .nav-group {
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: var(--s3) var(--s3) var(--s1);
  font-weight: 700;
}

.hq-side a:not(.brand-link) {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-size: var(--fs-body);
}

.hq-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
}

.hq-topbar .logo-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  text-decoration: none;
  color: var(--text);
}

.hq-topbar .logo-link img {
  height: 34px;
  width: auto;
  display: block;
}

.hq-subnav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 100%;
  gap: 6px;
  padding: var(--s2) 0 0;
}

.hq-subnav .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  min-height: 44px;
  padding: 0 8px;
  font-size: var(--fs-body);
  border-radius: 8px;
}

.hq-subnav .chip[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.tabbar.hq-tabs {
  display: none;
}

@media (min-width: 900px) {
  .hq-topbar .logo-link,
  .hq-subnav,
  .tabbar.hq-tabs {
    display: none;
  }
}

/* Stack record header on phones to avoid narrow text columns; row on desktop */
.record-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s3);
  margin-top: var(--s4);
}

.record-head .grow {
  width: 100%;
  flex: none;
}

.record-head .tools {
  width: 100%;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .hq-topbar {
    padding: var(--s2) 0;
    gap: var(--s2);
  }
  .hq-topbar .tools {
    display: none;
  }
  .hq-subnav {
    gap: 6px;
    padding: var(--s2) 0 0;
  }
  .hq-subnav .chip {
    min-height: 44px;
    padding: 0 8px;
    font-size: var(--fs-body);
  }
  .record-head {
    margin-top: var(--s2);
    padding: var(--s2) var(--s3);
    gap: var(--s2);
  }
  .record-head .avatar.lg {
    display: none;
  }
  .hq-topbar .tools .pill {
    display: none;
  }
  .auth-gate {
    margin-top: var(--s2);
    padding: var(--s2) var(--s3);
  }
  #auth-status-pill {
    display: none;
  }
  .partner-scope-facts {
    display: none;
  }
  body:not([data-auth-state="authorized"]) #hq-audit-log {
    display: none;
  }
}

@media (min-width: 900px) {
  .record-head {
    flex-direction: row;
    align-items: center;
  }
  .record-head .grow {
    width: auto;
    flex: 1 1 260px;
  }
  .record-head .tools {
    width: auto;
  }
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--s2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  max-width: 100%;
  overflow-x: visible;
}

.hq-grid {
  align-items: start;
}

.span-12 {
  grid-column: 1 / -1;
}

@media (min-width: 900px) {
  .span-12 {
    grid-column: span 12;
  }
  .span-9 {
    grid-column: span 9;
  }
  .span-7 {
    grid-column: span 7;
  }
  .span-5 {
    grid-column: span 5;
  }
  body:not([data-auth-state="authorized"]) .passport-side-card {
    grid-column: span 6;
  }
}

.mono,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: var(--fs-small);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.facts dd,
.kv dd,
.table td,
.table th,
.data-table td,
.data-table th,
.check-list li,
.card p,
.card li {
  overflow-wrap: break-word;
  word-break: normal;
}

.table td[data-label="Bitmask"],
.table td[data-label="Status"],
.facts dt code {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: var(--s2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: var(--s3);
  grid-template-columns: 1fr;
  min-width: 0;
  max-width: 100%;
}

.grid-2 > *,
.grid-3 > * {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 900px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.span-3 .facts,
.span-4 .facts {
  grid-template-columns: 1fr;
  gap: 2px;
}

.span-3 .facts dd,
.span-4 .facts dd {
  margin-bottom: var(--s2);
}

.table th {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.table th:first-child,
.table td[data-label="#"] {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  min-width: 40px;
}

@media (max-width: 899px) {
  .facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .facts dt {
    font-weight: 600;
  }
  .facts dd {
    margin-bottom: var(--s2);
    width: 100%;
  }
  .table td {
    flex-wrap: wrap;
    gap: var(--s2);
  }
  .list .row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s2);
  }
  .list .row .grow {
    width: 100%;
    flex: none;
  }
}

/* Padded tabs and card-style timeline items (resolves cramped-padding & side-tab) */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  padding: var(--s2);
  border-bottom: 0;
  background: #e8ecf2;
  border-radius: 10px;
}

.tabs [role="tab"] {
  min-height: var(--tap);
  padding: var(--s2) var(--s3);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.tabs [aria-selected="true"] {
  background: var(--surface);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(29, 26, 22, 0.12);
}

.timeline li {
  border-left: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s3) var(--s4);
  background: var(--bg);
  gap: 4px;
}

.pill {
  white-space: nowrap;
}

.pill.ok {
  background: #dcfce7;
  color: #14532d;
  font-weight: 600;
}

.pill.sample {
  background: #e8ecf2;
  color: #7c2d12;
  font-weight: 600;
}

.pill.live {
  background: #dcfce7;
  color: #14532d;
  font-weight: 600;
}

.pill.model {
  background: #e0f2fe;
  color: #075985;
  font-weight: 600;
}

.pill.gap {
  background: #fef3c7;
  color: #78350f;
  font-weight: 600;
}

/* Auth gate & protected HQ surface gating */
.auth-gate {
  margin-top: var(--s3);
  padding: var(--s3) var(--s4);
  border: 2px solid var(--accent);
  background: var(--surface);
}

.auth-gate-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s2);
}

.auth-gate-head .grow {
  width: 100%;
  flex: none;
}

.auth-gate-head .tools {
  width: 100%;
  flex-wrap: wrap;
}

@media (min-width: 900px) {
  .auth-gate-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
  }
  .auth-gate-head .grow {
    width: auto;
    flex: 1 1 280px;
  }
  .auth-gate-head .tools {
    width: auto;
  }
}

body:not([data-auth-state="authorized"]) [data-auth-required="true"] {
  display: none !important;
}

body[data-auth-state="authorized"] [data-auth-locked-notice="true"] {
  display: none !important;
}

.auth-locked-card {
  margin-top: var(--s3);
  padding: var(--s4);
  border: 1px dashed var(--accent);
  border-radius: var(--r);
  background: var(--surface);
}

/* Full-bleed Hero banner reaching both viewport edges at 1440px and 390px */
.hq-hero {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  border-radius: 0;
  position: relative;
  overflow: hidden;
  color: #ffffff;
  background: #1d1a16;
  display: flex;
  flex-direction: column;
}

.hq-hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center 35%;
}

.hq-hero-body {
  position: relative;
  z-index: 1;
  padding: var(--s4) var(--s4) var(--s5);
  max-width: 68ch;
  width: 100%;
}

@media (min-width: 900px) {
  .hq-hero {
    min-height: clamp(340px, 42vw, 440px);
    flex-direction: row;
    align-items: flex-end;
  }

  .hq-hero img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-position: center 35%;
  }

  .hq-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(29, 26, 22, 0.2) 15%, rgba(29, 26, 22, 0.88) 100%);
  }

  .hq-hero-body {
    padding: var(--s6) var(--s5);
  }
}

.hq-hero-body p {
  margin-top: var(--s2);
  color: #f4f5f7;
}

.hq-hero .btn:not(.btn-primary) {
  background: #ffffff;
  color: #1d1a16;
  border-color: #ffffff;
  font-weight: 600;
}

.hq-hero .btn:not(.btn-primary):hover,
.hq-hero .btn:not(.btn-primary):focus-visible {
  background: #f4f5f7;
  color: #1d1a16;
}

/* Swatches & Brand grid */
.swatch-grid {
  display: grid;
  gap: var(--s3);
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  margin-top: var(--s3);
}

@media (max-width: 640px) {
  .swatch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s2);
  }
}

.swatch {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
}

.swatch-color {
  height: 56px;
  border-bottom: 1px solid var(--line);
}

.swatch-clay { background: #b4441f; }
.swatch-clay-ink { background: #8f3416; }
.swatch-stone,
.swatch-canvas { background: var(--bg); }
.swatch-surface { background: #ffffff; }
.swatch-ink { background: #1d1a16; }
.swatch-muted { background: #5b5348; }
.swatch-line { background: #dfe3ea; }
.swatch-ok { background: #2f6b3a; }

.swatch-meta {
  padding: var(--s3);
}

@media (max-width: 640px) {
  .swatch-meta {
    padding: var(--s2);
  }
}

.logo-grid {
  display: grid;
  gap: var(--s3);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-top: var(--s3);
}

@media (max-width: 640px) {
  .logo-grid {
    grid-template-columns: 1fr;
    gap: var(--s2);
  }
  .logo-box {
    padding: var(--s3);
  }
}

.logo-strip {
  display: grid;
  gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  margin-top: var(--s3);
}

.logo-box {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s3) var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  background: var(--surface);
}

.logo-box.dark-preview {
  background: #1d1a16;
  color: #ffffff;
  border-color: #3d352c;
}

.logo-box.dark-preview .muted {
  color: #d8dde6;
}

.logo-box.dark-preview a,
.logo-box.dark-preview code {
  color: #f7b293;
}

.logo-box img {
  max-width: 100%;
  height: 40px;
  width: auto;
  object-fit: contain;
  align-self: flex-start;
}

/* Image guide & candid field scene cards */
.img-grid {
  display: grid;
  gap: var(--s4);
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  margin-top: var(--s3);
}

.img-card {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.img-card img,
.field-scene-img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center 30%;
  display: block;
  border-radius: 8px;
}

.img-card img {
  border-radius: 0;
}

.img-card-body {
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

/* QR container */
.qr-wrap {
  margin-top: var(--s3);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s1);
  padding: var(--s3);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.qr-wrap svg {
  display: block;
  width: 132px;
  height: 132px;
  max-width: 100%;
}

/* Calculator, Checklist & Qualifying Contact Forms */
.calc-grid,
.form-grid {
  display: grid;
  gap: var(--s4);
  margin-top: var(--s3);
}

@media (min-width: 900px) {
  .calc-grid,
  .form-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

label {
  display: block;
  font-weight: 600;
  margin: var(--s2) 0 var(--s1);
}

.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: var(--fs-small);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  min-height: 32px;
}

.calc-out {
  font-size: var(--fs-kpi);
  font-weight: 700;
  color: var(--accent-ink);
  font-family: var(--display);
  margin-top: var(--s1);
}

.check {
  display: flex;
  gap: var(--s3);
  align-items: flex-start;
  font-weight: 400;
  margin: var(--s2) 0;
  cursor: pointer;
}

.check input {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex: none;
}

.check > span {
  flex: 1;
  min-width: 0;
}

.hp {
  position: absolute;
  left: -5000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.err {
  color: var(--bad);
  font-size: var(--fs-small);
  min-height: 1.25em;
  margin-top: 2px;
}

.ok-msg {
  color: var(--ok);
  font-weight: 600;
}

.status-box {
  padding: var(--s3);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  margin-top: var(--s3);
  font-size: var(--fs-small);
}

.status-box.ok {
  border-color: var(--ok);
  color: #14532d;
  background: #eef6f0;
  font-weight: 600;
}

.status-box.bad {
  border-color: var(--bad);
  color: #7f1d1d;
  background: #fef2f2;
  font-weight: 600;
}

.meter {
  height: 12px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin: var(--s2) 0;
}

.meter span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.25s;
}

.meter span.w-0 { width: 0%; }
.meter span.w-25 { width: 25%; }
.meter span.w-50 { width: 50%; }
.meter span.w-75 { width: 75%; }
.meter span.w-100 { width: 100%; }

fieldset.opts {
  display: grid;
  gap: var(--s2);
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  fieldset.opts {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Footer inside HQ main */
.hq-footer {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s3);
  font-size: var(--fs-small);
  color: var(--muted);
}

/* Floating Feedback Button & Modal (ncd-feedback) */
.ncd-fb-btn {
  position: static;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ncd-fb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(29, 26, 22, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
}

.ncd-fb-backdrop[hidden] {
  display: none !important;
}

.ncd-fb-modal {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--s5);
  box-shadow: 0 12px 32px rgba(29, 26, 22, 0.3);
}

.ncd-fb-faces {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s2);
  margin: var(--s3) 0;
}

.ncd-fb-face {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
}

.ncd-fb-face[aria-pressed="true"] {
  border-color: var(--accent);
  background: #e8ecf2;
  color: #7c2d12;
}

.ncd-fb-choices {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin: var(--s3) 0;
}

.ncd-fb-choice {
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-small);
  text-align: left;
  cursor: pointer;
}

.ncd-fb-choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: #e8ecf2;
  color: #7c2d12;
  font-weight: 600;
}

.ncd-fb-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s2);
  margin-top: var(--s3);
}

.ncd-fb-actions-end {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s2);
  margin-top: var(--s3);
}

.ncd-fb-qprompt {
  margin-top: var(--s3);
  font-weight: 600;
}

.ncd-fb-label {
  display: block;
  margin-top: var(--s3);
  font-weight: 600;
}

.row2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
}

@media (max-width: 640px) {
  .row2 {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
