/* moneyness — structured-products finder. One stylesheet, no framework. */
:root {
  --bg: #0f1419;
  --panel: #1a2029;
  --panel-2: #222b36;
  --line: #2c3742;
  --ink: #e6edf3;
  --muted: #8b98a5;
  --accent: #3fb6a8;
  --accent-ink: #04120f;
  --pos: #4caf82;
  --warn: #e0a458;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.topbar {
  display: flex; align-items: baseline; gap: 16px;
  padding: 12px 20px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--accent); font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: .2px; }
.tagline { color: var(--muted); font-size: 13px; }
.asof { margin-left: auto; color: var(--muted); font-size: 12px; }

.content { padding: 16px 20px; }

.finder { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }

/* --- filters ------------------------------------------------------------ */
.filters {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; position: sticky; top: 16px;
}
.fld { display: block; margin-bottom: 12px; }
.fld > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.fld input, .fld select {
  width: 100%; padding: 7px 9px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
}
.fld.range { border: 0; margin: 0 0 12px; padding: 0; }
.fld.range .row { display: flex; gap: 6px; }
.fld.range input { width: 50%; }
.chk { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 10px 0 14px; }
.actions { display: flex; gap: 8px; }
button { cursor: pointer; border-radius: 7px; padding: 8px 12px; font-size: 13px; border: 1px solid var(--line); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; flex: 1; }
button.ghost { background: transparent; color: var(--ink); }
button:disabled { opacity: .4; cursor: default; }

/* --- results ------------------------------------------------------------ */
.results { min-width: 0; }
.results-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.count { color: var(--muted); }
.sort { color: var(--muted); font-size: 13px; }
.sort select { margin-left: 6px; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 9px 10px; color: var(--muted); font-weight: 600;
  background: var(--panel); border-bottom: 1px solid var(--line); white-space: nowrap;
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.delisted td { opacity: .5; }
td.isin { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); }
.empty td { text-align: center; color: var(--muted); padding: 28px; cursor: default; }

.pager { display: flex; align-items: center; gap: 14px; justify-content: center; margin: 14px 0; color: var(--muted); }

/* --- detail dialog ------------------------------------------------------ */
dialog {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  color: var(--ink); max-width: 560px; width: 92vw; padding: 0;
}
dialog::backdrop { background: rgba(0,0,0,.55); }
.detail-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.detail-head h2 { margin: 0; font-size: 16px; }
#d-body { margin: 0; padding: 16px 18px; display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; }
#d-body dt { color: var(--muted); }
#d-body dd { margin: 0; font-variant-numeric: tabular-nums; }

@media (max-width: 820px) {
  .finder { grid-template-columns: 1fr; }
  .filters { position: static; }
}
