:root {
  color-scheme: dark;
  --bg: #020912;
  --panel: #071624;
  --panel-2: #0d2432;
  --line: #315263;
  --line-bright: #dfb75b;
  --text: #f2e7ca;
  --muted: #a7b3b7;
  --teal: #38d5da;
  --teal-strong: #1497a6;
  --gold: #e5b84e;
  --ivory: #f2e7ca;
  --danger: #d8796c;
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0, rgba(22, 175, 186, .19), transparent 34rem),
    radial-gradient(circle at 88% 12%, rgba(226, 177, 68, .10), transparent 30rem),
    repeating-linear-gradient(90deg, rgba(239,226,191,.018) 0 1px, transparent 1px 52px),
    repeating-linear-gradient(0deg, rgba(239,226,191,.014) 0 1px, transparent 1px 34px),
    linear-gradient(180deg, #061522 0, var(--bg) 32rem);
  font: 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 3vw, 48px);
  border-bottom: 1px solid rgba(229,184,78,.62);
  background: linear-gradient(90deg, rgba(2,9,18,.97), rgba(7,26,38,.94), rgba(2,9,18,.97));
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.brand > span { display: grid; line-height: 1.05; }
.brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; font-weight: 650; color: var(--ivory); text-shadow: 0 2px 8px #000; }
.brand small { margin-top: 4px; color: var(--gold); font-size: .58rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.brand-mark { width: 62px; height: 62px; object-fit: contain; filter: drop-shadow(0 4px 10px #000); }
.status { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 5px rgba(100,193,198,.1); }

.workspace {
  width: min(1800px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 2.4vw, 38px);
  display: grid;
  grid-template-columns: minmax(380px, .92fr) minmax(560px, 1.08fr);
  gap: clamp(16px, 2vw, 28px);
}
.map-panel, .market-panel { min-width: 0; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(8,26,39,.97), rgba(4,15,25,.98)); box-shadow: var(--shadow), inset 0 0 0 1px rgba(229,184,78,.08); }
.map-panel { align-self: start; position: sticky; top: 96px; }
.panel-heading { padding: 22px 24px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 5px; color: var(--teal); font-size: .73rem; font-weight: 800; letter-spacing: .14em; }
h1, h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.025em; color: var(--ivory); text-shadow: 0 2px 10px #000; }
h1 { font-size: clamp(1.45rem, 2.2vw, 2rem); }
h2 { font-size: 1.7rem; }
.charter { margin: 6px 0 0; color: var(--muted); font-size: .88rem; }
.charter strong { color: var(--gold); font-weight: 650; }
.quiet-button, .filter-chip, .search-tips button, .month-chips button, .timeline-controls button {
  border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.quiet-button:hover, .filter-chip:hover, .search-tips button:hover, .month-chips button:hover, .timeline-controls button:hover { border-color: var(--line-bright); color: var(--teal); }
.quiet-button { padding: 7px 10px; font-size: .8rem; }

.map-scroll { overflow-x: auto; overflow-y: hidden; background: #050d16; -webkit-overflow-scrolling: touch; }
.market-svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.map-bg { fill: #050d16; }
.map-frame { fill: none; stroke: var(--gold); stroke-width: 3; }
.section-fill { stroke-width: 3; }
.section-floor .section-fill { fill: #0c2332; stroke: #eee2c1; }
.section-expansion .section-fill { fill: rgba(16,44,58,.38); stroke: #4d7684; stroke-width: 2; stroke-dasharray: 10 8; }
.section-restricted .section-fill { fill: #1a1c1e; stroke: var(--gold); stroke-width: 4; }
.section-restricted .section-inner { fill: rgba(199,189,157,.06); stroke: #685c3c; stroke-width: 2; }
.section-well .section-fill { fill: #0b2731; stroke: var(--teal); stroke-width: 4; }
.section-well .section-inner { fill: url(#water); stroke: #246c78; stroke-width: 2; }
.section-charter .section-fill { fill: #0b1c29; stroke: #eee2c1; }
.section-entrance .section-fill { fill: #0b1c29; stroke: #eee2c1; }
.icon-ring { fill: #061018; stroke-width: 4; }
.icon-ring.gold { stroke: var(--gold); }
.icon-ring.ivory { stroke: var(--ivory); }
.icon-hole { fill: #000; }
.icon-cross { stroke: #7c6040; stroke-width: 5; fill: none; }
.icon-water { fill: #168b99; stroke: var(--teal); stroke-width: 3; }
.icon-charter { fill: #0b6f7b; stroke: var(--gold); stroke-width: 3; }
.icon-charter-core { fill: var(--teal); opacity: .85; }
.icon-arrow { fill: none; stroke: var(--gold); stroke-width: 3; }
.section-label { font: 800 17px Inter, "Segoe UI", sans-serif; letter-spacing: .1em; fill: var(--gold); }
.section-sublabel { font: 600 13px Inter, "Segoe UI", sans-serif; letter-spacing: .08em; fill: #c6d0d2; }
.section-floor .section-label { fill: var(--teal); }
.section-well .section-label { fill: var(--teal); }
.section-expansion .section-label { fill: #7da1ad; }
.section-floor .section-sublabel { fill: #a7b3b7; }
.section-expansion .section-sublabel { fill: #7da1ad; }

.cluster { cursor: pointer; outline: none; }
.cluster-hit { fill: rgba(5,13,22,.35); stroke: rgba(216,209,189,.3); stroke-width: 1.5; transition: stroke .15s, fill .15s; }
.stand-cell { fill: rgba(216,209,189,.12); stroke: #8ea2aa; stroke-width: 1.4; transition: fill .15s, stroke .15s; }
.cluster-number { font: 800 20px Inter, "Segoe UI", sans-serif; fill: var(--ivory); paint-order: stroke; stroke: #020912; stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.stand-number { font: 800 13px Inter, "Segoe UI", sans-serif; fill: #07121d; opacity: 0; pointer-events: none; }
.cluster-tag { font: 800 12px Inter, "Segoe UI", sans-serif; letter-spacing: .1em; fill: var(--teal); opacity: 0; pointer-events: none; paint-order: stroke; stroke: #020912; stroke-width: 3px; }
.cluster:hover .cluster-hit, .cluster:focus-visible .cluster-hit { stroke: var(--teal); fill: rgba(54,139,151,.18); }
.cluster.has-offers .cluster-hit { stroke: rgba(229,184,78,.8); }
.cluster.has-offers .stand-cell { stroke: var(--gold); }
.cluster.expanded .cluster-hit, .cluster.selected .cluster-hit { stroke: var(--teal); fill: rgba(54,139,151,.22); stroke-width: 2; }
.cluster.expanded .cluster-number { opacity: 0; }
.cluster.expanded .cluster-tag, .cluster.expanded .stand-number { opacity: 1; }
.cluster.expanded .stand-cell { fill: #d8d1bd; stroke: #f0ead9; }
.cluster.expanded .stand.has-offers .stand-cell { fill: #8be3e6; stroke: var(--gold); }
.cluster.expanded .stand:hover .stand-cell { fill: var(--teal); }
.cluster.expanded .stand { cursor: pointer; }
.stand.selected .stand-cell { fill: var(--teal) !important; stroke: #fff !important; stroke-width: 2; }
.stand.highlighted .stand-cell { fill: var(--gold) !important; stroke: #fff !important; stroke-width: 2; }
.locator-ring { fill: none; stroke: var(--gold); stroke-width: 3; }
.locator-pulse { fill: rgba(229,184,78,.25); stroke: var(--gold); stroke-width: 1; transform-box: fill-box; transform-origin: center; animation: pulse 1.6s ease-out infinite; }
.locator-bubble-box { fill: #080b0a; stroke: var(--gold); stroke-width: 1.5; }
.locator-label { font: 800 12px Inter, "Segoe UI", sans-serif; fill: var(--ivory); }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .locator-pulse { animation: none; } }

.stand-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--line); background: rgba(4,13,21,.72); }
.picker-heading { color: var(--teal); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin-right: 4px; }
.picker-stand { min-width: 38px; height: 32px; padding: 0 8px; border: 1px solid var(--line); background: var(--panel-2); font-size: .78rem; font-weight: 750; cursor: pointer; }
.picker-stand.has-offers { border-color: rgba(229,184,78,.7); }
.picker-stand.active { color: #031014; background: var(--teal); border-color: #c8f1ef; }
.partial-note { padding: 9px 20px; color: #f0c87b; background: rgba(120,96,55,.16); border-bottom: 1px solid rgba(229,184,78,.35); font-size: .78rem; }
tbody tr.locatable { cursor: pointer; }
tbody tr.located { background: rgba(229,184,78,.10); box-shadow: inset 3px 0 0 var(--gold); }
.stall.legacy { color: var(--muted); font-weight: 600; }
.stale { color: #d9b36a; }
.map-help { margin: 0; padding: 13px 20px 15px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); }
.map-help strong { color: var(--gold); }

.market-heading { align-items: center; }
.count { color: var(--muted); font-size: .82rem; text-align: right; }
.count strong { color: var(--text); }
.search-row { display: flex; gap: 10px; padding: 18px 20px 8px; }
.search-box { flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--line); background: #0c100e; }
.search-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(100,193,198,.08); }
.search-box svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.search-box input::placeholder { color: #6f7c74; }
kbd { border: 1px solid #334039; border-bottom-width: 2px; padding: 1px 7px; color: var(--muted); background: #161c19; font-size: .72rem; }
.filter-chip { padding: 0 13px; color: var(--teal); font-size: .82rem; }
.search-tips { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 20px 17px; border-bottom: 1px solid var(--line); }
.search-tips button { padding: 4px 8px; color: var(--muted); font-size: .72rem; }
.stock-note { margin: 0 20px 16px; padding: 11px 13px; border: 1px solid rgba(229,184,78,.38); border-left: 3px solid var(--gold); color: #c6d0d2; background: rgba(4,13,21,.72); font-size: .78rem; }
.stock-note strong { color: var(--gold); }

.timeline { padding: 14px 20px 15px; border-bottom: 1px solid var(--line); background: #0e1311; }
.timeline-labels { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; margin-bottom: 8px; }
.timeline-labels .eyebrow { margin: 0; }
#snapshot-label { color: var(--muted); font-size: .78rem; }
.timeline-controls { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; gap: 10px; }
.timeline-controls button { height: 30px; font-size: 1.3rem; line-height: 1; }
input[type="range"] { width: 100%; accent-color: var(--teal-strong); }
.month-chips { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.month-chips button { padding: 3px 7px; color: var(--muted); font-size: .7rem; white-space: nowrap; }
.month-chips button.active { color: #041016; background: var(--teal); border-color: var(--teal); }

.table-status { padding: 10px 20px; min-height: 40px; color: var(--muted); font-size: .8rem; border-bottom: 1px solid var(--line); }
.table-status.error { color: var(--danger); }
.table-wrap { overflow: auto; max-height: calc(100vh - 337px); min-height: 300px; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
thead { position: sticky; top: 0; z-index: 5; background: #151b18; }
th { padding: 0; text-align: left; color: var(--muted); border-bottom: 1px solid #344038; }
th button { width: 100%; padding: 11px 12px; border: 0; background: transparent; color: inherit; text-align: inherit; font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
th button:hover { color: var(--teal); }
td { padding: 9px 12px; border-bottom: 1px solid #202923; vertical-align: middle; }
tbody tr:hover { background: rgba(100,193,198,.06); }
.stall { color: var(--gold); font-weight: 750; }
.item { display: flex; align-items: center; gap: 9px; min-width: 160px; }
.item-icon { flex: 0 0 auto; position: relative; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #334039; background: #0c100e; color: #718079; font-family: Georgia, serif; font-size: .72rem; }
.item-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.item-icon img.overlay { z-index: 2; }
.item-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-name small { color: var(--muted); }
.quality { display: inline-flex; min-width: 38px; justify-content: center; padding: 2px 6px; border: 1px solid #3e4d45; color: #c6d5cb; background: #151b18; font-variant-numeric: tabular-nums; }
.quality.high { color: #d4e39f; border-color: #5b6840; }
.quality.very-high { color: #f0c87b; border-color: #786037; }
.muted { color: var(--muted); }
.price-x { color: var(--gold); font-weight: 750; }
.availability { display: inline-flex; align-items: center; min-width: 74px; padding: 3px 7px; border: 1px solid; font-size: .72rem; font-weight: 750; white-space: nowrap; }
.availability.available { color: #a9eef0; border-color: rgba(56,213,218,.45); background: rgba(20,151,166,.12); }
.availability.unavailable { color: #efaaa0; border-color: rgba(216,121,108,.5); background: rgba(216,121,108,.10); }
.empty-row td { padding: 50px 20px; color: var(--muted); text-align: center; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .map-panel { position: static; }
  .table-wrap { max-height: 65vh; }
}
@media (max-width: 720px) {
  .topbar { height: 64px; padding: 0 14px; }
  .brand-mark { width: 50px; height: 50px; }
  .status { max-width: 46%; text-align: right; font-size: .72rem; }
  .workspace { padding: 10px; gap: 10px; }
  .panel-heading { padding: 17px 16px 14px; }
  .market-svg { min-width: 640px; }
  .search-row { padding: 14px 14px 7px; }
  .search-tips, .timeline { padding-left: 14px; padding-right: 14px; }
  .stock-note { margin-left: 14px; margin-right: 14px; }
  .count { display: none; }
  .table-wrap { max-height: 62vh; }
  th button, td { padding-left: 9px; padding-right: 9px; }
  th:nth-child(6), td:nth-child(6) { display: none; }
}


.map-pan-hint { display: none; margin: 0; padding: 6px 16px; font-size: .74rem; color: var(--muted); background: rgba(4,13,21,.72); border-top: 1px solid var(--line); }
@media (max-width: 720px) { .map-pan-hint { display: block; } }

