/* QuadCOM V74 · INSTRUMENT FRAME
   Shared layout layer for every public chamber and generated Desk.
   It changes presentation only: no feed, engine, state or evidence authority. */

:root {
  --qc-frame: rgba(200, 155, 54, .38);
  --qc-frame-hot: rgba(231, 191, 89, .72);
  --qc-frame-quiet: rgba(200, 155, 54, .14);
  --qc-surface: rgba(5, 7, 5, .975);
  --qc-surface-raised: rgba(10, 12, 9, .985);
  --qc-rail-width: 184px;
  --qc-gutter: clamp(12px, 2.2vw, 30px);
  --qc-panel-gap: clamp(7px, 1vw, 12px);
}

/* PUBLIC FRAME ------------------------------------------------------- */
body:has(.qc-shell) {
  background:
    linear-gradient(90deg, rgba(231, 191, 89, .025) 1px, transparent 1px) 0 0 / 80px 80px,
    #020302;
}

.qc-shell {
  position: relative;
  isolation: isolate;
  overflow: clip;
}

.qc-shell::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(231, 191, 89, .025) 50%, transparent),
    radial-gradient(circle at 75% 0, rgba(112, 174, 184, .045), transparent 28%);
}

.qc-head {
  min-height: 48px;
  padding: 5px max(10px, env(safe-area-inset-right)) 5px max(10px, env(safe-area-inset-left));
  border-bottom-color: var(--qc-frame);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .34);
}

.qc-brand {
  min-height: 38px;
  padding-right: 10px;
}

.qc-brand img {
  width: 34px;
  height: 34px;
}

.qc-brand b { font-size: 13px; }
.qc-brand small { font-size: 8px; }

.qc-nav { gap: 3px; }
.qc-nav a {
  position: relative;
  min-height: 36px;
  padding-inline: 10px;
  border-bottom: 1px solid transparent;
  font-size: 10px;
}
.qc-nav a::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(.25);
}
.qc-nav a:hover::after,
.qc-nav a:focus-visible::after,
.qc-nav a[aria-current="page"]::after {
  opacity: .8;
  transform: scaleX(1);
}

.qc-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-left: 1px solid var(--qc-frame-quiet);
  padding-left: 10px;
  letter-spacing: .09em;
}
.qc-live::before {
  content: "";
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: var(--green);
  box-shadow: 0 0 8px rgba(135, 186, 161, .42);
}

.qc-main {
  width: min(1240px, 100%);
  padding: clamp(18px, 3.1vw, 42px) var(--qc-gutter) clamp(28px, 5vw, 64px);
}

.qc-main > .qc-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  margin: 0 0 8px;
  font-size: 10px;
}
.qc-main > .qc-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border: 1px solid var(--hot);
  transform: rotate(45deg);
}
.qc-main > .qc-title {
  max-width: 16ch;
  margin: 0;
  font-size: clamp(30px, 5.1vw, 68px);
  line-height: .92;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.qc-main > .qc-sub {
  max-width: 72ch;
  margin: 14px 0 0;
  font-size: clamp(13px, 1.2vw, 16px);
  line-height: 1.65;
}
.qc-main > .qc-rule {
  position: relative;
  height: 10px;
  margin: 18px 0 14px;
  background:
    linear-gradient(90deg, var(--qc-frame-hot), var(--qc-frame-quiet) 72%, transparent) 0 50% / 100% 1px no-repeat;
}
.qc-main > .qc-rule::before,
.qc-main > .qc-rule::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 4px;
  height: 4px;
  transform: rotate(45deg);
  background: var(--hot);
}
.qc-main > .qc-rule::before { left: 0; }
.qc-main > .qc-rule::after { left: min(72%, 840px); opacity: .45; }

.qc-grid {
  grid-auto-flow: row dense;
  gap: var(--qc-panel-gap);
  align-items: stretch;
}

.qc-panel {
  min-height: 118px;
  padding: clamp(13px, 1.45vw, 19px);
  border-color: var(--qc-frame);
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(231, 191, 89, .035), transparent 34%),
    linear-gradient(155deg, var(--qc-surface-raised), var(--qc-surface));
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 184, .035),
    0 12px 32px rgba(0, 0, 0, .16);
}
.qc-panel::before,
.qc-panel::after {
  width: 10px;
  height: 10px;
}
.qc-panel h2,
.qc-panel h3 {
  margin-bottom: 11px;
  font-size: 12px;
  line-height: 1.25;
  letter-spacing: .115em;
}
.qc-panel p,
.qc-panel li {
  font-size: clamp(12px, 1.05vw, 14px);
  line-height: 1.68;
}
.qc-panel p:first-of-type { margin-top: 8px; }
.qc-panel p:last-child { margin-bottom: 0; }

.qc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 0;
  margin: 6px 5px 0 0;
  box-shadow: inset 0 1px rgba(255, 255, 255, .025);
}
.qc-btn::after {
  content: "›";
  margin-left: 10px;
  color: currentColor;
  opacity: .7;
}
.qc-btn:hover,
.qc-btn:focus-visible { border-color: var(--hot); background-color: rgba(231, 191, 89, .07); }
.qc-btn.primary { box-shadow: inset 0 1px rgba(255, 255, 255, .18), 0 7px 18px rgba(0, 0, 0, .2); }

.qc-metric {
  min-height: 42px;
  align-items: center;
  padding: 9px 2px;
  border-top-color: var(--qc-frame-quiet);
}
.qc-metric span { font-size: 10px; letter-spacing: .04em; }
.qc-metric b { font-size: 11px; text-align: right; }

.qc-search,
.qc-replay-load select,
.qc-replay-controls select {
  border-radius: 0;
  min-height: 44px;
  background: linear-gradient(180deg, #070907, #030403);
}
.qc-search { padding-inline: 14px; }

.qc-pager {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--qc-frame-quiet);
}
.qc-pager a { display: inline-flex; align-items: center; border-radius: 0; }

.qc-footer {
  gap: 14px;
  padding-top: 15px;
  padding-bottom: max(70px, calc(env(safe-area-inset-bottom) + 62px));
  border-top-color: var(--qc-frame);
  background: rgba(2, 3, 2, .88);
}
.qc-footnav { gap: 2px 16px; }
.qc-footnav a { position: relative; min-height: 32px; }
.qc-footnav a:hover,
.qc-footnav a:focus-visible { color: var(--hot); }

/* Public component families */
.qc-deskcard,
.qc-coin-card,
.qc-hyper-card {
  display: flex;
  flex-direction: column;
}
.qc-deskcard p,
.qc-coin-card p,
.qc-hyper-card p { flex: 1; }
.qc-deskcard .qc-btn,
.qc-coin-card .qc-btn,
.qc-hyper-card .qc-btn { align-self: flex-start; }

.qc-deskcard h2,
.qc-coin-card h2 {
  gap: 12px;
  min-height: 48px;
}
.qc-coin-stage {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  padding: 2px;
  border: 1px solid rgba(231, 191, 89, .22);
  background: rgba(0, 0, 0, .5);
}
.qc-coin-stage-lg {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
}
.qc-coin {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: 50% 50% !important;
}

.qc-chip {
  min-height: 38px;
  padding-right: 13px;
  border-radius: 0;
  background: rgba(3, 4, 3, .82);
}
.qc-chip img { border-radius: 0; object-fit: contain; }

.qc-system-rows,
.qc-replay-summary,
.qc-replay-state,
.qc-replay-trade,
.qc-attribution-gates,
.qc-attribution-mini,
.qc-replay-trace,
.qc-gate-list {
  gap: 2px;
  background: var(--qc-frame-quiet);
}
.qc-health-row,
.qc-replay-cell,
.qc-attribution-gate,
.qc-attribution-mini > div,
.qc-replay-trace > div,
.qc-gate-list li { background: rgba(4, 6, 4, .97); }

.qc-sys-summary,
.qc-foundry-state,
.qc-table-scroll { border-radius: 0; border-color: var(--qc-frame); }
.qc-sys-summary { margin-bottom: var(--qc-panel-gap); }

.qc-table-scroll {
  background: rgba(2, 3, 2, .92);
  scrollbar-color: var(--gold) #050605;
}
.qc-table-scroll thead th { background: #0b0c09; }

.qc-foundry-hero { gap: var(--qc-panel-gap); }
.qc-stage-chain { gap: 5px; }
.qc-stage {
  border-color: var(--qc-frame);
  background: linear-gradient(155deg, #0b0d0a, #030403);
}
.qc-reference-grid { gap: var(--qc-panel-gap); }
.qc-reference { border-color: var(--qc-frame); }
.qc-reference figcaption { min-height: 70px; }

.qc-sheet-panel,
.qc-icon-btn,
.qc-seg,
.qc-toast { border-radius: 0; }
.qc-sheet-panel { border-color: var(--qc-frame-hot); }
.qc-row { min-height: 58px; }
.qc-row:hover { border-left: 1px solid var(--hot); }

/* A wide display becomes an operator rail, not a stretched website header. */
@media (min-width: 1240px) and (min-height: 640px) {
  .qc-head {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--qc-rail-width);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 18px 11px max(18px, env(safe-area-inset-bottom));
    border: 0;
    border-right: 1px solid var(--qc-frame);
    box-shadow: 12px 0 38px rgba(0, 0, 0, .36);
  }
  .qc-brand {
    min-height: 62px;
    padding: 0 2px 14px;
    border-bottom: 1px solid var(--qc-frame-quiet);
  }
  .qc-brand img { width: 38px; height: 38px; }
  .qc-brand b { font-size: 13px; }
  .qc-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .qc-nav a {
    min-height: 42px;
    justify-content: space-between;
    padding: 0 9px;
    border: 0;
    border-left: 1px solid transparent;
    font-size: 10px;
  }
  .qc-nav a::after {
    left: auto;
    right: 8px;
    top: 18px;
    bottom: auto;
    width: 6px;
    height: 6px;
    transform: rotate(45deg) scale(.4);
    transform-origin: 50% 50%;
  }
  .qc-nav a:hover,
  .qc-nav a:focus-visible,
  .qc-nav a[aria-current="page"] {
    border-left-color: var(--hot);
    background: linear-gradient(90deg, rgba(231, 191, 89, .1), transparent);
  }
  .qc-nav a:hover::after,
  .qc-nav a:focus-visible::after,
  .qc-nav a[aria-current="page"]::after { transform: rotate(45deg) scale(1); }
  .qc-live {
    margin-top: auto;
    min-height: 38px;
    border: 0;
    border-top: 1px solid var(--qc-frame-quiet);
    padding: 14px 3px 0;
  }
  .qc-progress { top: auto; right: 0; bottom: 0; left: 0; width: auto; height: 2px; }
  .qc-main {
    width: min(1240px, calc(100vw - var(--qc-rail-width) - (var(--qc-gutter) * 2)));
    margin-left: calc(var(--qc-rail-width) + var(--qc-gutter));
    margin-right: auto;
  }
  .qc-footer {
    margin-left: var(--qc-rail-width);
    padding-left: var(--qc-gutter);
    padding-right: var(--qc-gutter);
    padding-bottom: 18px;
  }
  .qc-top { right: var(--qc-gutter); bottom: 18px; }
  .qc-deskcard,
  .qc-coin-card { grid-column: span 4; }
  .qc-reference-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 761px) and (max-width: 1020px) {
  .qc-panel { grid-column: span 6; }
  .qc-span8,
  .qc-span12 { grid-column: span 12; }
}

/* Phone portrait is a compact instrument stack, not a column of oversized cards. */
@media (max-width: 760px) {
  :root { --qc-panel-gap: 6px; --qc-gutter: 8px; }
  .qc-head { min-height: 52px; padding: 5px 9px; }
  .qc-brand { min-height: 40px; }
  .qc-brand img { width: 32px; height: 32px; }
  .qc-live { padding-left: 8px; font-size: 9px; }
  .qc-main { padding: 17px var(--qc-gutter) 28px; }
  .qc-main > .qc-kicker { margin-bottom: 7px; }
  .qc-main > .qc-title { font-size: clamp(28px, 10vw, 42px); }
  .qc-main > .qc-sub { margin-top: 11px; font-size: 13px; line-height: 1.58; }
  .qc-main > .qc-rule { margin: 13px 0 9px; }
  .qc-panel,
  .qc-span4,
  .qc-span6,
  .qc-span8,
  .qc-span12 { grid-column: 1 / -1; }
  .qc-panel { min-height: 0; padding: 13px 12px; }
  .qc-panel h2,
  .qc-panel h3 { margin-bottom: 9px; }
  .qc-panel p,
  .qc-panel li { font-size: 13px; line-height: 1.58; }
  .qc-deskcard,
  .qc-coin-card { min-height: 0; }
  .qc-deskcard h2,
  .qc-coin-card h2 { min-height: 42px; margin-bottom: 6px; }
  .qc-coin-stage { width: 38px; height: 38px; flex-basis: 38px; }
  .qc-coin-stage-lg { width: 44px; height: 44px; flex-basis: 44px; }
  .qc-deskcard p,
  .qc-coin-card p { margin: 5px 0 9px; }
  .qc-btn { width: auto; min-height: 42px; }
  .qc-footer { padding-inline: var(--qc-gutter); }
  .qc-foundry-mark { min-height: 190px; }
  .qc-reference figcaption { min-height: 0; }
}

/* Landscape phones trade the bottom bar for a slim side command rail. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 980px) {
  .qc-head {
    position: sticky;
    min-height: 38px;
    height: 38px;
    padding: 2px 8px;
  }
  .qc-brand { min-height: 34px; }
  .qc-brand img { width: 25px; height: 25px; }
  .qc-brand small { display: none; }
  .qc-shell { padding: 0 calc(64px + env(safe-area-inset-right)) 0 env(safe-area-inset-left); }
  .qc-main { padding: 10px 10px 18px; }
  .qc-main > .qc-kicker { margin: 0; min-height: 18px; }
  .qc-main > .qc-title { font-size: clamp(25px, 5.5vw, 38px); }
  .qc-main > .qc-sub { margin-top: 7px; max-width: 82ch; font-size: 11px; line-height: 1.45; }
  .qc-main > .qc-rule { height: 5px; margin: 8px 0 6px; }
  .qc-panel,
  .qc-span4,
  .qc-span6,
  .qc-span8 { grid-column: span 6; padding: 10px; }
  .qc-span12,
  .qc-replay-load { grid-column: 1 / -1; }
  .qc-panel p,
  .qc-panel li { font-size: 11px; line-height: 1.45; }
  .qc-tabbar {
    display: grid;
    position: fixed;
    z-index: 40;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: calc(64px + env(safe-area-inset-right));
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) 0;
    border: 0;
    border-left: 1px solid var(--qc-frame);
    background: rgba(3, 4, 3, .98);
  }
  .qc-tabbar a {
    min-height: 0;
    justify-content: center;
    gap: 2px;
    padding: 3px;
    border-bottom: 1px solid var(--qc-frame-quiet);
    font-size: 8px;
  }
  .qc-tab-orb {
    width: 34px;
    height: 34px;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    transform: rotate(45deg) scale(.72);
  }
  .qc-tab-orb .qc-ic { width: 23px; height: 23px; transform: rotate(-45deg); }
  .qc-top { right: calc(72px + env(safe-area-inset-right)) !important; bottom: 8px !important; }
  .qc-toasts { bottom: 8px !important; width: min(70vw, 440px); }
  .qc-footer { padding-bottom: 12px; }
}

/* DESK FRAME ---------------------------------------------------------
   Optical and structural only. Engine markup and four-cell trade remain intact. */
html[data-qc-build="74"] .app {
  background:
    linear-gradient(90deg, rgba(231, 191, 89, .018) 1px, transparent 1px) 0 0 / 32px 32px,
    radial-gradient(circle at 50% 112%, rgba(231, 191, 89, .055), transparent 34%),
    #010201 !important;
}
html[data-qc-build="74"] .top {
  border-color: var(--b2) !important;
  border-radius: 0 !important;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .28) !important;
}
html[data-qc-build="74"] .panel {
  border-radius: 0 !important;
  box-shadow: inset 0 1px rgba(255, 241, 186, .025) !important;
}
html[data-qc-build="74"] .ph {
  border-bottom: 1px solid rgba(214, 189, 101, .15);
  padding-inline: 2px;
}
html[data-qc-build="74"] .k,
html[data-qc-build="74"] .metric,
html[data-qc-build="74"] .tradeCell,
html[data-qc-build="74"] .mcell,
html[data-qc-build="74"] .hudBox,
html[data-qc-build="74"] .list {
  border-radius: 0 !important;
}
html[data-qc-build="74"] .btcIcon,
html[data-qc-build="74"] .qcCoin {
  object-fit: contain !important;
  object-position: 50% 50% !important;
  background-position: 50% 50% !important;
  background-size: contain !important;
  transform: none !important;
}
html[data-qc-build="74"] #tradePanel .tradeBox {
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr 1fr !important;
}

@media (orientation: landscape) {
  html[data-qc-build="74"][data-qc-device="iphone13"] .app {
    grid-template-rows: 25px minmax(0, 1fr) !important;
    gap: 3px !important;
  }
  html[data-qc-build="74"][data-qc-device="iphone13"] .cockpit { gap: 4px !important; }
  html[data-qc-build="74"][data-qc-device="iphone13"] .panel { border-color: rgba(200, 155, 54, .42) !important; }
  html[data-qc-build="74"][data-qc-device="iphone13"] .ph { height: 12px !important; }
  html[data-qc-build="74"][data-qc-device="iphone13"] .body,
  html[data-qc-build="74"][data-qc-device="iphone13"] .list,
  html[data-qc-build="74"][data-qc-device="iphone13"] .metricStack { height: calc(100% - 12px) !important; }
}

@media (orientation: portrait) {
  html[data-qc-build="74"][data-qc-device="iphone13"] .qcDeskBar {
    gap: 2px;
    border-radius: 0;
  }
  html[data-qc-build="74"][data-qc-device="iphone13"] .qcDeskBar a {
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qc-nav a::after { transition: none; }
}

@media print {
  .qc-shell::before { display: none; }
}
