:root {
  color-scheme: dark;
  --edge-bg: #000000;
  --edge-panel: #0b0f14;
  --edge-panel-2: #10161d;
  --edge-panel-3: #151c24;
  --edge-line: #252d36;
  --edge-line-2: #303944;
  --edge-text: #f3f6fb;
  --edge-muted: #8b949e;
  --edge-subtle: #6e7681;
  --edge-orange: #ea580c;
  --edge-orange-2: #ff7a1a;
  --edge-green: #3fb950;
  --edge-red: #f85149;
  --edge-blue: #58a6ff;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; background: var(--edge-bg); }
body {
  margin: 0;
  color: var(--edge-text);
  background: var(--edge-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}
button, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--edge-orange-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.positive { color: var(--edge-green); }
.negative { color: var(--edge-red); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.ql-seo-noscript { display: block; max-width: 800px; margin: 80px auto; padding: 24px; }

.edge-shell {
  min-height: calc(100vh - 58px);
  border-top: 1px solid #191f26;
}
.edge-loading {
  min-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--edge-muted);
  font-weight: 700;
}
.edge-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--edge-line-2);
  border-top-color: var(--edge-orange);
  border-radius: 50%;
  animation: edge-spin .8s linear infinite;
}
@keyframes edge-spin { to { transform: rotate(360deg); } }

.edge-layout {
  width: min(1600px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr) 336px;
  min-height: calc(100vh - 58px);
}
.edge-rail,
.edge-inspector { background: #070a0e; }
.edge-rail { border-right: 1px solid var(--edge-line); }
.edge-inspector { border-left: 1px solid var(--edge-line); }
.edge-workspace { min-width: 0; background: #030507; }

.edge-product-head,
.edge-event-head,
.edge-inspector-head {
  min-height: 74px;
  border-bottom: 1px solid var(--edge-line);
  display: flex;
  align-items: center;
}
.edge-product-head { padding: 14px 16px; justify-content: space-between; }
.edge-product-name { display: flex; align-items: center; gap: 10px; }
.edge-product-name i { color: var(--edge-orange); font-size: 18px; }
.edge-product-name strong { display: block; font-size: 15px; }
.edge-product-name span { display: block; color: var(--edge-orange-2); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.edge-event-head { padding: 12px 18px; gap: 14px; justify-content: space-between; }
.edge-event-title { min-width: 0; }
.edge-event-title h1 { margin: 0; font-size: 23px; line-height: 1.2; }
.edge-event-title .meta-line { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 12px; color: var(--edge-muted); font-size: 12px; }
.edge-event-title .probability { color: var(--edge-green); font-size: 18px; font-weight: 900; }
.head-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.icon-button,
.edge-button,
.edge-select,
.scenario-card,
.event-row,
.brief-link {
  border: 1px solid var(--edge-line-2);
  border-radius: 7px;
  background: var(--edge-panel-2);
  color: var(--edge-text);
}
.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.edge-button {
  min-height: 36px;
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
}
.edge-button:hover,
.icon-button:hover { border-color: #56616e; background: #18212b; }
.edge-button.primary { background: var(--edge-orange); border-color: var(--edge-orange); color: #fff; }
.edge-button.primary:hover { background: #c94a09; }
.edge-button.watching { color: #ffd36a; border-color: rgba(234, 88, 12, .55); background: rgba(234, 88, 12, .14); }
.edge-button:focus-visible,
.icon-button:focus-visible,
.event-row:focus-visible,
.scenario-card:focus-visible,
.brief-link:focus-visible {
  outline: 2px solid var(--edge-orange);
  outline-offset: 2px;
}

.rail-controls { padding: 12px; display: grid; grid-template-columns: 1fr 36px; gap: 8px; border-bottom: 1px solid var(--edge-line); }
.edge-select { min-height: 36px; padding: 7px 10px; outline: none; width: 100%; }
.edge-select:focus { border-color: var(--edge-orange); }
.rail-label { padding: 13px 16px 7px; color: var(--edge-subtle); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.rail-label.move-label { border-top: 1px solid var(--edge-line); margin-top: 6px; }
.event-list { display: grid; }
.event-row {
  width: 100%;
  border-width: 0 0 1px 0;
  border-radius: 0;
  background: transparent;
  padding: 13px 15px;
  text-align: left;
  min-height: 93px;
}
.event-row:hover { background: #0d1218; }
.event-row.active { background: #111820; box-shadow: inset 3px 0 0 var(--edge-orange); }
.event-row-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.event-row strong { color: #fff; font-size: 13px; line-height: 1.35; }
.event-row .odds { font-size: 13px; font-weight: 900; color: var(--edge-green); white-space: nowrap; }
.event-row .odds.down { color: var(--edge-red); }
.event-row-meta { margin-top: 7px; display: flex; justify-content: space-between; gap: 8px; color: var(--edge-muted); font-size: 11px; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--edge-green); margin-right: 5px; }
.brief-link {
  margin: 12px;
  width: calc(100% - 24px);
  min-height: 42px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  font-weight: 800;
}
.brief-link i { color: var(--edge-orange); }
.brief-link small { display: block; margin-top: 2px; color: var(--edge-muted); font-weight: 600; }

.workspace-tools {
  padding: 12px 18px;
  border-bottom: 1px solid var(--edge-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.portfolio-control { display: flex; align-items: center; gap: 8px; }
.portfolio-control label,
.mobile-event-control label { color: var(--edge-muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.mobile-event-control { display: none; }
.data-state { color: var(--edge-muted); font-size: 11px; text-align: right; }
.data-state strong { color: var(--edge-text); }
.data-state.live strong { color: var(--edge-green); }

.scenario-switcher {
  padding: 10px 18px;
  border-bottom: 1px solid var(--edge-line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: stretch;
  max-width: 690px;
  margin: 0 auto;
}
.scenario-card { padding: 9px 13px; background: #0b0f14; text-align: center; }
.scenario-card strong { display: block; color: var(--edge-muted); font-size: 12px; }
.scenario-card span { display: block; color: var(--edge-subtle); font-size: 11px; margin-top: 2px; }
.scenario-card b { display: block; margin-top: 3px; font-size: 12px; }
.scenario-card.active { border-color: var(--edge-orange); background: rgba(234, 88, 12, .15); box-shadow: inset 0 0 0 1px rgba(234, 88, 12, .18); }
.scenario-card.active strong, .scenario-card.active b { color: var(--edge-orange-2); }
.versus { display: grid; place-items: center; color: var(--edge-muted); font-size: 10px; font-weight: 900; }

.workspace-body { padding: 0 18px 18px; }
.metric-compare {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) repeat(3, minmax(100px, .7fr));
  border-bottom: 1px solid var(--edge-line);
  padding: 12px 0;
}
.metric-compare > div { padding: 5px 10px; }
.metric-compare .metric-name { color: #c9d1d9; font-size: 12px; padding-left: 0; }
.metric-compare .metric-value { font-size: 17px; font-weight: 900; }
.metric-compare .metric-value.good { color: var(--edge-green); }
.metric-compare .metric-value.bad { color: var(--edge-red); }
.metric-compare .metric-difference { color: var(--edge-green); font-size: 12px; font-weight: 800; }

.section { padding: 14px 0; border-bottom: 1px solid var(--edge-line); }
.section:last-child { border-bottom: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head h2, .inspector-block h2 { margin: 0; font-size: 13px; }
.section-head small { color: var(--edge-muted); }
.mapping-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.mapping-title { color: var(--edge-green); font-size: 12px; margin-bottom: 7px; }
.mapping-title.risk { color: var(--edge-red); }
.mapping-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mapping-table th, .mapping-table td { padding: 7px 6px; border-bottom: 1px solid #1c232b; text-align: left; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapping-table th { color: var(--edge-muted); font-weight: 700; }
.mapping-table td:first-child { color: #fff; font-weight: 850; }
.mapping-table .positive { color: var(--edge-green); font-weight: 800; }
.mapping-table .negative { color: var(--edge-red); font-weight: 800; }
.sector-strip { display: grid; grid-template-columns: repeat(5, minmax(92px, 1fr)); gap: 1px; background: var(--edge-line); border: 1px solid var(--edge-line); }
.sector-item { background: #080c10; padding: 10px; min-width: 0; }
.sector-item span { display: block; color: var(--edge-muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sector-item strong { display: block; margin-top: 4px; font-size: 13px; }

.timeline { display: grid; grid-template-columns: repeat(6, minmax(90px, 1fr)); overflow-x: auto; padding-bottom: 3px; }
.timeline-item { min-width: 112px; padding: 4px 10px 8px 18px; border-top: 1px solid var(--edge-line-2); position: relative; }
.timeline-item::before { content: ""; position: absolute; left: 0; top: -5px; width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--edge-muted); background: #080c10; }
.timeline-item.complete::before { border-color: var(--edge-green); background: var(--edge-green); }
.timeline-item.next::before { border-color: var(--edge-orange); background: var(--edge-orange); }
.timeline-item time { color: var(--edge-muted); font-size: 10px; }
.timeline-item.next time { color: var(--edge-orange-2); }
.timeline-item strong { display: block; margin-top: 5px; color: #fff; font-size: 11px; }
.timeline-item span { display: block; margin-top: 3px; color: var(--edge-muted); font-size: 10px; }
.resolution-rule { margin: 10px 0 0; color: var(--edge-muted); font-size: 11px; }
.resolution-rule strong { color: #d8dee8; }

.edge-inspector-head { padding: 12px 14px; justify-content: space-between; }
.edge-inspector-head h2 { margin: 0; font-size: 13px; }
.inspector-scroll { padding: 12px; display: grid; gap: 10px; }
.inspector-block { border: 1px solid var(--edge-line); border-radius: 7px; background: var(--edge-panel); padding: 12px; }
.inspector-block h2 { margin-bottom: 9px; text-transform: uppercase; color: #d8dee8; font-size: 11px; letter-spacing: .06em; }
.inspector-block p { margin: 0; color: #c9d1d9; font-size: 12px; }
.odds-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.odds-grid div { min-width: 0; }
.odds-grid span { display: block; color: var(--edge-muted); font-size: 9px; text-transform: uppercase; }
.odds-grid strong { display: block; margin-top: 3px; color: #fff; font-size: 19px; }
.odds-grid strong.accent { color: var(--edge-orange-2); }
.chart-wrap { height: 142px; position: relative; }
.chart-fallback { height: 100%; display: grid; place-items: center; text-align: center; color: var(--edge-muted) !important; }
.driver-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.driver-list li { padding-left: 12px; position: relative; color: #b7c0ca; font-size: 11px; }
.driver-list li::before { content: ""; position: absolute; left: 0; top: .55em; width: 5px; height: 5px; border-radius: 50%; background: var(--edge-orange); }
.driver-list a { display: block; margin-top: 2px; font-size: 10px; }
.confidence-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.confidence-grid span { display: block; color: var(--edge-muted); font-size: 10px; }
.confidence-grid strong { display: block; margin-top: 3px; color: var(--edge-green); }
.inspector-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 7px; }

.edge-modal { position: fixed; inset: 0; z-index: 10020; display: grid; place-items: center; padding: 18px; }
.edge-modal[hidden] { display: none; }
.edge-modal-backdrop { position: absolute; inset: 0; border: 0; background: rgba(0, 0, 0, .74); }
.edge-modal-panel { position: relative; z-index: 1; width: min(680px, 100%); max-height: min(780px, calc(100vh - 36px)); overflow: auto; border: 1px solid var(--edge-line-2); border-radius: 8px; background: #0b0f14; }
.edge-modal-panel > header { padding: 16px; border-bottom: 1px solid var(--edge-line); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.edge-modal-panel h2 { margin: 4px 0 0; font-size: 21px; }
.eyebrow { color: var(--edge-orange-2); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.edge-modal-content { padding: 16px; }
.brief-summary { padding-bottom: 13px; color: #c9d1d9; border-bottom: 1px solid var(--edge-line); }
.brief-event { padding: 13px 0; border-bottom: 1px solid var(--edge-line); }
.brief-event:last-child { border-bottom: 0; }
.brief-event h3 { margin: 0; font-size: 14px; }
.brief-event p { margin: 5px 0 0; color: var(--edge-muted); font-size: 12px; }
.brief-event .brief-numbers { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; }
.edge-toast { position: fixed; right: 18px; bottom: 18px; z-index: 10030; max-width: 360px; padding: 11px 14px; border: 1px solid rgba(234, 88, 12, .55); border-radius: 7px; background: #111820; color: #fff; transform: translateY(24px); opacity: 0; pointer-events: none; transition: .18s ease; }
.edge-toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 1260px) {
  .edge-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .edge-inspector { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--edge-line); }
  .inspector-scroll { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inspector-block.explanation { grid-column: span 2; }
}

@media (max-width: 820px) {
  .edge-layout { display: block; }
  .edge-rail { border-right: 0; border-bottom: 1px solid var(--edge-line); }
  .edge-product-head { min-height: 58px; }
  .rail-controls, .rail-label, .event-list { display: none; }
  .edge-rail.open .rail-controls { display: grid; }
  .edge-rail.open .rail-label, .edge-rail.open .event-list { display: block; }
  .brief-link { margin: 8px 12px 12px; }
  .edge-event-head { align-items: flex-start; }
  .edge-event-title h1 { font-size: 19px; }
  .head-actions .edge-button span { display: none; }
  .workspace-tools { align-items: flex-start; flex-wrap: wrap; }
  .portfolio-control,
  .mobile-event-control { align-items: flex-start; flex-direction: column; min-width: min(100%, 230px); }
  .mobile-event-control { display: flex; }
  .data-state { flex: 1 1 100%; max-width: 100%; text-align: left; overflow-wrap: anywhere; }
  .mapping-grid { grid-template-columns: 1fr; }
  .sector-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inspector-scroll { grid-template-columns: 1fr; }
  .inspector-block.explanation { grid-column: auto; }
}

@media (max-width: 560px) {
  .edge-event-head, .workspace-tools, .workspace-body { padding-left: 12px; padding-right: 12px; }
  .edge-event-head { display: grid; }
  .head-actions { width: 100%; }
  .head-actions .edge-button { flex: 1; }
  .scenario-switcher { margin: 0; padding-left: 12px; padding-right: 12px; grid-template-columns: 1fr; gap: 6px; }
  .versus { min-height: 18px; }
  .workspace-tools { display: grid; grid-template-columns: 1fr; }
  .portfolio-control,
  .mobile-event-control { min-width: 0; width: 100%; }
  .metric-compare { grid-template-columns: minmax(112px, 1.2fr) repeat(2, minmax(76px, 1fr)); }
  .metric-compare .metric-difference { display: none; }
  .metric-compare .metric-value { font-size: 15px; }
  .mapping-table th:nth-child(4), .mapping-table td:nth-child(4) { display: none; }
  .odds-grid { grid-template-columns: repeat(3, 1fr); }
}
