:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --accent: #1e3a8a;
  --accent-soft: #eff6ff;
  --hot: #b91c1c;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--accent); color: #fff; padding: 0 1.5rem; height: 56px;
}
.brand { color: #fff; font-weight: 700; letter-spacing: .04em; text-decoration: none; font-size: 14px; }
.topbar nav a { color: #c7d2fe; text-decoration: none; margin-left: 1.25rem; font-weight: 500; }
.topbar nav a:hover { color: #fff; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; gap: 1rem; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1.25rem; margin-bottom: 1.25rem;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid var(--line); padding: .5rem .6rem; }
table.grid td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
table.grid.tight td, table.grid.tight th { padding: .35rem .55rem; }
table.grid a { color: var(--accent); text-decoration: none; }
td.hot { color: var(--hot); font-weight: 600; }
.scroll-x { overflow-x: auto; }
.tag { background: var(--accent-soft); color: var(--accent); border-radius: 5px;
  padding: .1rem .45rem; font-size: 12px; font-weight: 600; }
.form-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.form-row input, .form-row select { flex: 1 1 130px; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.field { display: flex; flex-direction: column; gap: .25rem; font-size: 13px; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: .5rem; }
input, select {
  font: inherit; padding: .5rem .6rem; border: 1px solid #cbd5e1;
  border-radius: 7px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.rate-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
button, .btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 7px;
  padding: .55rem 1rem; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: #1e40af; }
.btn-sm { font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 600; }
.search {
  width: 100%; max-width: 360px; margin-bottom: 1rem;
  padding: .6rem .8rem; font-size: 15px;
}
.edit-station summary {
  cursor: pointer; font-weight: 600; color: var(--accent);
  list-style-position: inside;
}
.edit-station[open] summary { margin-bottom: .25rem; }
.flash { padding: .65rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: 14px; }
.flash.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash.err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* multi-class additions */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.btn-row { display: flex; gap: .5rem; }
.btn-outline { background: #fff; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 7px; padding: .55rem 1rem; font: inherit; font-weight: 600;
  text-decoration: none; display: inline-block; cursor: pointer; }
.btn-outline:hover { background: var(--accent-soft); }
.btn-danger { background: #fff; color: var(--hot); border: 1px solid #fecaca;
  border-radius: 7px; padding: .4rem .8rem; font: inherit; font-weight: 600; cursor: pointer; }
.btn-danger:hover { background: #fef2f2; }
tr.subtotal td { border-top: 2px solid var(--line); background: #f8fafc; }
.ladder-cards { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .6rem; }
@media (max-width: 720px) { .ladder-cards { grid-auto-flow: row; grid-auto-columns: auto; } }
.ladder-card { border: 1px solid var(--line); border-radius: 9px; padding: .7rem .8rem;
  background: #fff; }
.ladder-card.lur { border-color: #86efac; background: #f0fdf4; }
.ladder-card.fixed { border-color: #fecaca; background: #fef2f2; }
.lc-label { font-size: 12px; font-weight: 700; color: var(--ink); }
.lc-desc { font-size: 11px; color: var(--muted); min-height: 14px; margin: .1rem 0 .35rem; }
.lc-total { font-size: 1.15rem; font-weight: 700; }
.sticky-totals { position: sticky; top: 8px; z-index: 5; }

tr.lur-row td { background: #f0fdf4; }
@media print {
  .topbar, .no-print { display: none !important; }
  .wrap { max-width: none; }
  .card { break-inside: avoid; border-color: #ccc; }
}

/* print / client report */
@media print {
  .topbar, .no-print { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card { break-inside: avoid; border-color: #ddd; }
}
tr.lur-row td { background: #f0fdf4; }

.filter-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-row .search { margin-bottom: 0; }

/* --- review / pending-parse UI --- */
.pill { display:inline-block; padding:1px 8px; border-radius:10px; font-size:.72rem;
  font-weight:600; background:#e8eef5; color:#34506b; vertical-align:middle; }
.pill.llm  { background:#ece6fb; color:#5b3fb0; }
.pill.good { background:#e3f3e8; color:#1f7a44; }
.pill.hot  { background:#fbe6e6; color:#b3261e; }
.issues { margin:.5rem 0 0; padding-left:0; list-style:none; }
.issues li { color:#9a4310; font-size:.85rem; padding:2px 0; }
.actions { display:flex; gap:.6rem; margin:1rem 0 2rem; }
.btn-primary { background:#1f6feb; color:#fff; border:none; padding:.6rem 1.2rem;
  border-radius:6px; font-weight:600; cursor:pointer; font-size:.95rem; }
.btn-primary:hover { background:#195bc4; }
h3.dp { margin:1.1rem 0 .3rem; font-size:.82rem; letter-spacing:.04em;
  text-transform:uppercase; color:#5a6b7d; border-bottom:1px solid #e4e9ef; padding-bottom:2px; }
.field.inline { flex-direction:row; align-items:center; gap:.4rem; }

.navbadge { background:#b3261e; color:#fff; border-radius:9px; padding:0 6px; font-size:.7rem; font-weight:700; }

/* --- async parse: processing state --- */
.card.processing { text-align:center; padding:2.4rem 1.5rem; }
.spinner { width:34px; height:34px; margin:0 auto 1rem; border-radius:50%;
  border:3px solid #d7dee6; border-top-color:#1f6feb; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.card.processing .actions { justify-content:center; }
.card.processing form { display:inline; }

/* --- rate-type tabs + pills --- */
.tabs { display:flex; gap:.4rem; margin:.2rem 0 1rem; flex-wrap:wrap; }
.tab { padding:.3rem .8rem; border-radius:6px; font-size:.85rem; text-decoration:none;
  color:#34506b; background:#eef2f6; }
.tab.on { background:#1f6feb; color:#fff; }
.pill.type-candidate { background:#e3f3e8; color:#1f7a44; }
.pill.type-issue     { background:#fff3e0; color:#9a5b00; }
.pill.type-corporate { background:#e8eaff; color:#3a3fb0; }
.pill.quarter { background:#eef0f3; color:#42506a; border:1px solid #d6dbe4; }

/* --- market groups on the stations index --- */
.market-group { border: 1px solid var(--line); border-radius: 8px; margin-bottom: .75rem;
  background: #fff; overflow: hidden; }
.market-group > summary { list-style: none; cursor: pointer; padding: .7rem 1rem;
  display: flex; align-items: center; gap: .6rem; font-weight: 600;
  background: #f7f9fb; user-select: none; }
.market-group > summary::-webkit-details-marker { display: none; }
.market-group > summary::before { content: "▸"; color: #8a97a6; font-size: .8rem;
  transition: transform .12s ease; }
.market-group[open] > summary::before { transform: rotate(90deg); }
.market-group[open] > summary { border-bottom: 1px solid var(--line); }
.market-group .mkt-count { background: #e7edf3; color: #42506a; border-radius: 999px;
  padding: .05rem .5rem; font-size: .72rem; font-weight: 600; }
.market-group .mkt-fc { margin-left: auto; font-size: .78rem; font-weight: 500; }
.market-group .mkt-links { margin-left: auto; display: flex; gap: .8rem;
  font-size: .78rem; font-weight: 500; }
.market-group table.grid { margin: 0; border: 0; }
.market-group table.grid th { background: #fff; }

/* --- site footer --- */
.site-foot { max-width: 1080px; margin: 2.5rem auto 1.5rem; padding: 1rem 1.5rem 0;
  border-top: 1px solid var(--line); display: flex; align-items: baseline; gap: .6rem;
  font-size: 12px; color: var(--muted); }
.site-foot .foot-brand { font-weight: 700; letter-spacing: .04em; color: #6b7686; }
.site-foot a { color: var(--accent); text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }

/* --- searchable combobox (market pickers) --- */
.combo { position: relative; display: inline-block; }
.combo-input { min-width: 200px; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + .2rem); left: 0;
  margin: 0; padding: .25rem; list-style: none; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; min-width: 100%;
  max-height: 280px; overflow: auto; box-shadow: 0 8px 24px rgba(15,23,42,.12); }
.combo-list[hidden] { display: none; }
.combo-list li { padding: .4rem .55rem; border-radius: 6px; cursor: pointer;
  font-size: 14px; white-space: nowrap; color: var(--ink); }
.combo-list li:hover, .combo-list li.active { background: var(--accent-soft); }
.combo-list li[hidden] { display: none; }
.combo-empty { padding: .4rem .55rem; font-size: 13px; color: var(--muted); }
.combo-empty[hidden] { display: none; }

/* --- drag & drop upload zone --- */
.dropzone { position: relative; border: 2px dashed #cbd5e1; border-radius: 10px;
  padding: 1.7rem 1rem; text-align: center; background: #fafcff;
  transition: border-color .12s, background .12s; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; }
.dz-prompt { display: flex; flex-direction: column; gap: .25rem; pointer-events: none; }
.dz-prompt strong { font-size: 15px; color: var(--ink); }
.dz-files { list-style: none; margin: .6rem 0 0; padding: 0; display: flex;
  flex-wrap: wrap; gap: .4rem; align-items: center; }
.dz-files[hidden] { display: none; }
.dz-files li { font-size: 12px; background: #eef2f7; border-radius: 6px;
  padding: .25rem .55rem; color: #42506a; }
.dz-files li.dz-count { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
