
:root {
  color-scheme: dark;
  --page: #100f0d;
  --surface: #191611;
  --raised: #201b14;
  --field: #130f0d;
  --line: #3b3024;
  --muted: #ada091;
  --dim: #8f8070;
  --text: #f0e5d2;
  --gold: #eac076;
  --gold-line: #9c6b37;
  --aqua: #67c7af;
  --rose: #ef9585;
  --blue: #8ab4dd;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --display: Cinzel, Georgia, serif;
  --body: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse 75% 28rem at 55% 1rem, #2c2117 0%, transparent 82%), var(--page);
  color: var(--text);
  font: 14px/1.5 var(--body);
}
h1, h2, h3, p { margin: 0; }
a { color: var(--gold); text-underline-offset: 3px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.wrap { width: min(1480px, calc(100% - 68px)); margin-inline: auto; }
.masthead { border-block: 1px solid #413021; background: #100e0c; box-shadow: 0 9px 30px #0005; }
.masthead-inner { display: flex; align-items: center; min-height: 75px; gap: 54px; }
.brand { display: flex; align-items: center; gap: 13px; flex: 0 0 auto; color: var(--gold); text-decoration: none; }
.brand strong { display: block; font: 800 22px/1 var(--display); letter-spacing: .035em; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; }
.crest { display: grid; place-items: center; width: 32px; height: 34px; border-radius: 5px 5px 15px 15px; border: 1px solid #ae7540; background: linear-gradient(135deg, #4e3d23, #1c211b); color: #f3cc8b; box-shadow: inset 0 0 0 2px #16110e, 0 0 15px #bd702838; }
.crest span { font-size: 23px; line-height: 1; }
nav { display: flex; align-self: stretch; align-items: center; gap: 28px; }
nav a { display: flex; align-items: center; height: 100%; border-block-end: 2px solid transparent; text-decoration: none; white-space: nowrap; color: var(--muted); font-weight: 600; }
nav a[aria-current="page"] { color: var(--gold); border-block-end-color: #ca9452; }
nav a:hover, .plain:hover { color: var(--gold); }
.realm { margin-left: auto; color: #d0c1ab; white-space: nowrap; font-size: 12px; }
.realm i { display: inline-block; width: 7px; height: 7px; background: var(--aqua); box-shadow: 0 0 14px #67c7af7a; border-radius: 50%; margin-right: 7px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 32px 0 20px; }
.eyebrow { color: var(--gold); font: 600 10px/1.6 var(--mono); letter-spacing: .21em; text-transform: uppercase; }
h1 { color: #f4e3c5; margin-top: 3px; font: 700 clamp(26px, 4vw, 41px)/1.15 var(--display); }
h2 { font: 700 19px/1.25 var(--display); color: #ead6b5; }
h3 { font: 700 15px/1.25 var(--body); }
.asof { color: var(--muted); text-align: right; font-size: 12px; }
.asof b { display: block; color: var(--text); font-size: 13px; font-weight: 600; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 21px; background: linear-gradient(115deg, #261e14, #191611 46%); overflow: hidden; }
.metrics > div { padding: 15px 19px; min-width: 0; }
.metrics > div + div { border-left: 1px solid var(--line); }
.metrics span, .metrics small { display: block; color: var(--muted); font-size: 11px; }
.metrics strong { display: block; margin: 2px 0 1px; font: 600 clamp(21px, 2.6vw, 29px)/1.42 var(--mono); color: var(--gold); white-space: nowrap; }
.workspace { display: grid; grid-template-columns: minmax(320px, .92fr) minmax(0, 1.72fr); gap: 17px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 10px 24px #0002; min-width: 0; }
.inventory > header, .detail-head { padding: 17px 17px 13px; border-bottom: 1px solid #2e261d; }
.inventory > header { display: flex; justify-content: space-between; align-items: center; gap: 5px; }
.inventory > header span { color: var(--muted); font: 11px var(--mono); }
.item-controls { padding: 12px 13px; display: grid; gap: 11px; }
.search { display: flex; gap: 8px; align-items: center; padding: 0 10px; background: var(--field); border: 1px solid var(--line); border-radius: 5px; color: var(--gold); }
.search span { font-size: 20px; }
.search input { width: 100%; padding: 8px 0; outline: none; border: 0; color: var(--text); background: none; min-width: 0; }
.search:focus-within { outline: 1px solid var(--gold); }
.filters, .segments { display: flex; flex-wrap: wrap; gap: 4px; }
.filters button, .segments button, .plain, .page button { padding: 5px 8px; border-radius: 4px; border: 1px solid #493a2c; background: #211a13; color: var(--muted); white-space: nowrap; font-size: 11px; }
.filters button:hover, .segments button:hover, .page button:hover { color: var(--gold); }
.filters button[aria-pressed="true"], .segments button[aria-pressed="true"], .primary { background: #3b2a18; border-color: #8a6237; color: #f5cb86; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: var(--muted); background: #211b14; font-weight: 600; text-align: left; white-space: nowrap; }
th, td { padding: 9px 11px; border-bottom: 1px solid #30271e; }
th button { padding: 0; border: 0; background: none; color: inherit; font-weight: inherit; }
td:first-child { width: 100%; }
.index-list td { padding: 0 8px; }
.index-list td:nth-child(n+2), .index-list th:nth-child(n+2) { text-align: right; }
tbody tr:hover { background: #282016; }
tbody tr.selected { background: linear-gradient(90deg, #51361d 0, #35281b 2px, #2b2117 100%); }
.item-link { border: 0; padding: 8px 0; width: 100%; background: transparent; text-align: left; display: flex; align-items: center; gap: 8px; color: #eadfce; }
.item-link:hover { color: var(--gold); }
.item-icon { width: 24px; height: 24px; flex-shrink: 0; border: 1px solid #6f5534; border-radius: 4px; background: #33271a; display: grid; place-items: center; object-fit: cover; color: var(--gold); font: 12px var(--display); }
.item-icon.big { width: 46px; height: 46px; border-color: #946942; box-shadow: 0 2px 10px #0006; }
.number { font: 500 11px var(--mono); white-space: nowrap; color: #e7d2a9; }
.up { color: var(--aqua) !important; }
.down { color: var(--rose) !important; }
.dim { color: var(--dim); }
.page { color: var(--muted); padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 5px; font: 11px var(--mono); }
.page button:disabled { opacity: .35; cursor: default; }
.detail-head { display: flex; align-items: center; gap: 12px; min-height: 76px; }
.detail-head .head-content { min-width: 0; flex: 1; }
.detail-head p { color: var(--muted); font-size: 11px; margin-top: 3px; }
.detail-head h2 { font-size: clamp(16px, 2.6vw, 23px); }
.detail-head .plain { align-self: center; }
.detail-body { padding: 15px 17px 17px; }
.item-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
.item-kpis > div { padding: 8px 9px; background: #211b14; border: 1px solid #362b20; border-radius: 5px; }
.item-kpis span, .item-kpis small { display: block; color: var(--muted); font-size: 10px; }
.item-kpis strong { display: block; margin-top: 2px; font: 600 clamp(13px, 1.6vw, 19px)/1.45 var(--mono); color: #f4d19b; white-space: nowrap; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.chart-key { min-height: 20px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 5px 16px; font-size: 11px; }
.chart-key span { display: inline-flex; gap: 5px; align-items: center; }
.chart-key i { width: 11px; height: 3px; border-radius: 2px; }
.chart-wrap { position: relative; height: 252px; background: #15120f; border: 1px solid #372c20; border-radius: 5px; overflow: hidden; }
.chart-wrap canvas { display: block; width: 100%; height: 100%; }
.chart-tooltip { position: absolute; pointer-events: none; max-width: 245px; z-index: 1; background: #211a14; color: #f2e3c9; border: 1px solid #8a693f; border-radius: 4px; padding: 5px 8px; font: 11px var(--mono); white-space: nowrap; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); margin: 0; padding: 24px; text-align: center; }
.detail-note { color: #c3b29e; font-size: 12px; margin-top: 9px; line-height: 1.6; }
.detail-extras { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; margin-top: 12px; }
.mini-panel { background: #201a14; padding: 11px 12px; border: 1px solid #382c21; border-radius: 5px; }
.mini-panel h3 { color: var(--gold); font-size: 12px; margin-bottom: 5px; }
.mini-panel p { font-size: 11.5px; color: #cabcaa; }
.mini-panel p + p { margin-top: 6px; }
.mini-panel table th, .mini-panel table td { padding: 3px 2px; font-size: 11px; }
.mini-panel table th { background: transparent; }
.mini-panel td:nth-child(n+2), .mini-panel th:nth-child(n+2) { text-align:right; }
.plain { font-weight: 600; padding: 6px 10px; text-decoration: none; }
.research, .coverage, .journal { padding: 19px; }
.research-controls { display: flex; flex-wrap: wrap; margin-bottom: 13px; gap: 11px; }
.research-controls label, .form-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
select, .form-grid input { background: var(--field); border: 1px solid #53402d; color: var(--text); border-radius: 4px; padding: 5px 8px; max-width: 100%; }
.toggle { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
input[type="checkbox"] { accent-color: #b68347; }
.research-chart { height: clamp(250px, 34vw, 376px); }
.research-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 13px 0; }
.research-grid > div { padding: 14px 16px; }
.research-grid h3 { color: var(--gold); padding-bottom: 5px; }
.research-grid p, .coverage p { color: var(--muted); font-size: 12px; }
.coverage-row { display: grid; grid-template-columns: minmax(140px,.55fr) 2fr; gap: 10px; border-top: 1px solid var(--line); padding: 10px 0; }
.coverage-row:first-child { margin-top: 10px; }
.coverage-row strong { color: var(--text); }
.journal h2 { margin-bottom: 12px; }
.scroll { overflow: auto; }
.journal td:first-child { width: auto; min-width: 150px; }
.journal td { white-space: nowrap; }
dialog { width: min(420px, calc(100% - 28px)); padding: 19px; color: var(--text); }
dialog::backdrop { background: #0009; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.form-grid label:first-child { grid-column: span 2; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.footer { padding-block: 25px 19px; display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); }
.footer a { color: var(--muted); }
@media (max-width: 1000px) {
  .wrap { width: calc(100% - 32px); }
  .masthead-inner { gap: 27px; }
  nav { gap: 18px; }
  .workspace { grid-template-columns: minmax(270px,.9fr) minmax(0,1.45fr); gap: 10px; }
  .detail-body { padding-inline: 12px; }
}
@media (max-width: 760px) {
  .wrap { width: calc(100% - 24px); }
  .masthead-inner { flex-wrap: wrap; column-gap: 12px; row-gap: 0; justify-content: space-between; padding-top: 11px; }
  .realm { margin-left: 0; }
  nav { min-height: 44px; width: 100%; order: 3; gap: 18px; }
  nav a { height: 44px; font-size: 12px; }
  .intro { padding-top: 20px; }
  .workspace { display: flex; flex-direction: column-reverse; align-items: stretch; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics > div { padding: 9px 10px; }
  .metrics > div:nth-child(3) { border-left: 0; }
  .metrics > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .research-grid { grid-template-columns: 1fr; }
  .chart-head { align-items: flex-start; flex-wrap: wrap; }
}
@media (max-width: 410px) {
  .item-kpis { grid-template-columns: 1fr 1fr; }
  .detail-extras, .coverage-row { grid-template-columns: 1fr; }
  .asof { font-size: 10px; }
}
.target { width: 64px; padding: 2px 5px; border-radius: 4px; border: 1px solid var(--gold-line); background: var(--field); color: var(--text); }
.research-open { margin-top: 8px; }
.intro-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.mobile-items { display: none; }
@media (min-width: 1060px) { .research-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } }
@media (max-width: 760px) { .mobile-items { display: inline-block; } }
.setup-panel { margin-top: 16px; padding: 16px 17px; }
.setup-panel .detail-note { margin: 3px 0 11px; }
.setup-panel td:first-child { min-width: 185px; }
.setup-panel td:not(:first-child) { white-space: nowrap; font-family: var(--mono); }
.setup-panel .item-link { padding-block: 1px; }
#agreement { margin-bottom: 12px; }
#agreement .detail-note { margin: 6px 0 9px; }
#agreement th:first-child { min-width: 155px; }
#agreement .item-link { padding-block: 2px; }
#agreement td:not(:first-child) { text-align: right; }

.crate-metrics { margin-bottom: 16px; }
.crate-metrics strong {
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: clamp(16px, 2.1vw, 25px);
}
.crate-board { padding: 0 0 12px; }
.crate-controls { padding: 13px 16px; margin: 0; gap: 13px; }
.crate-controls label { min-width: 120px; }
.crate-controls select { min-height: 31px; }
.crate-scroll { max-height: 450px; }
.crate-table { min-width: 880px; font-variant-numeric: tabular-nums; }
.crate-table thead th { position: sticky; top: 0; z-index: 2; background: #241d15; }
.crate-table th:nth-child(n+2):not(:nth-child(4)):not(:last-child),
.crate-table td:nth-child(n+2):not(:nth-child(4)):not(:last-child) { text-align: right; }
.crate-table td { padding-block: 5px; }
.crate-table td:first-child { width: 1%; min-width: 173px; }
.crate-table td:nth-child(4) { min-width: 138px; font-size: 11px; }
.crate-table .item-link { padding: 3px 0; }
.crate-name > span { display: block; }
.crate-name small, .crate-secondary { color: var(--muted); font-size: 10px; line-height: 1.45; }
.crate-secondary { display: block; }
.crate-signal { display: inline-block; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; white-space: nowrap; font-weight: 600; font-size: 10px; color: var(--muted); }
.crate-signal.watch { color: #efc680; border-color: #765332; background: #352619; }
.crate-signal.active { color: var(--aqua); border-color: #376154; background: #182d24; }
.crate-signal.moved { color: var(--blue); border-color: #404e62; background: #1b2531; }
.crate-signal.refill { color: var(--rose); border-color: #633d32; background: #2c1e18; }
.crate-board > .detail-note { margin: 9px 16px 0; font-size: 11px; }
.crate-inspect { margin-top: 14px; }
.crate-analysis { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(245px, 1fr); gap: 14px; }
.crate-chart { height: 225px; }
#crate-explanation > .chart-head { flex-wrap: wrap; }
#crate-explanation td:not(:first-child), #crate-explanation th:not(:first-child) { white-space: nowrap; }
#crate-explanation .crate-secondary { margin-top: 6px; }
.crate-method { margin-top: 14px; padding: 12px 16px; }
.crate-method summary { cursor: pointer; color: var(--gold); font-weight: 600; }
.crate-method p { margin-top: 8px; color: var(--muted); font-size: 12px; }
@media (max-width: 760px) {
  .crate-analysis { grid-template-columns: minmax(0, 1fr); }
  .crate-scroll { max-height: 390px; }
  .crate-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .crate-controls label { min-width: 0; }
  .masthead nav { gap: clamp(8px, 3vw, 18px); }
  .masthead nav a { font-size: 11px; }
}
@media (max-width: 760px) {
  .crate-controls label { grid-template-columns: minmax(0,1fr); }
  .crate-controls select { width: 100%; min-width: 0; }
}
