:root {
  --bg: #0f1419; --panel: #1a2029; --text: #e6e9ef; --muted: #8b94a3;
  --info: #3b82f6; --warn: #f59e0b; --urgent: #ef4444; --expired: #6b7280;
  --accent: #22c55e;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: .8rem 1.5rem;
  background: var(--panel); border-bottom: 1px solid #2a3340;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.bell-btn { background: transparent; border: 0; font-size: 1.15rem; line-height: 1; padding: .15rem .3rem; cursor: pointer; }
.bell-btn:disabled { opacity: .5; cursor: not-allowed; }
.head-extra { display: inline-flex; align-items: center; gap: .7rem; font-size: .85rem; }
.brand { font-weight: 700; font-size: 1.1rem; display: inline-flex; flex-direction: column; line-height: 1.05; }
.brand-co { font-size: .6rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.brand-co-lg { font-weight: 600; letter-spacing: .04em; color: var(--accent); margin: -.2rem 0 .4rem; }
.appfoot { max-width: 960px; margin: 2rem auto 1rem; padding: .8rem 1.5rem 0; border-top: 1px solid #2a3340; color: var(--muted); font-size: .78rem; text-align: center; }
nav a { margin-right: 1.2rem; color: var(--muted); }
nav a:hover { color: var(--text); }
main { max-width: 960px; margin: 0 auto; padding: 1.5rem; }
/* Data-dense pages (e.g. the scanner) get more room. */
main.wide { max-width: min(1500px, 96vw); }
/* Scan results: keep cells on one line; scroll horizontally if it overflows. */
#scan-results, #scan-order-out { overflow-x: auto; }
.scan-results th, .scan-results td { white-space: nowrap; }
h1, h2 { font-weight: 600; }
.muted { color: var(--muted); font-size: .9rem; }
.empty { color: var(--muted); padding: 1rem 0; }

.chain-search { display: flex; gap: .6rem; margin-bottom: 1rem; }
.chain-search input[name="keyword"] { flex: 1; }
.root-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.root-list button { background: var(--panel); color: var(--text); text-align: left; width: 100%; border: 1px solid #2a3340; }
.root-list button:hover { border-color: var(--accent); }
.chain-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; flex-wrap: wrap; }
.chain-scroll { overflow-x: auto; }
table.chain { min-width: 760px; }
table.chain td, table.chain th { text-align: center; padding: .3rem .4rem; white-space: nowrap; }
table.chain .strike { font-weight: 700; background: #1a2029; }
button.mini { padding: .05rem .35rem; font-size: .75rem; margin: 0 1px; border-radius: 4px; }
button.mini.sell { background: var(--urgent); color: #fff; }
button.mini.buy { background: var(--info); color: #fff; }
.order-ticket, .order-preview { background: var(--panel); border: 1px solid #2a3340; border-radius: 10px; padding: 1rem 1.2rem; margin-top: 1rem; }
.order-ticket h3, .order-preview h3 { margin-top: 0; }
.delay-badge { background: rgba(245, 158, 11, .15); color: var(--warn); font-size: .78rem;
  padding: .15rem .5rem; border-radius: 999px; white-space: nowrap; }
.fab { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 50; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.ticket-dialog { background: var(--panel); color: var(--text); border: 1px solid #2a3340;
  border-radius: 12px; padding: 1.2rem; max-width: 580px; width: 92%; }
.ticket-dialog::backdrop { background: rgba(0,0,0,.55); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.dialog-head h3 { margin: 0; }
.ticket-net { font-weight: 700; font-variant-numeric: tabular-nums; margin: .4rem 0 .8rem; }
.pick-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex;
  align-items: center; justify-content: center; gap: 1rem; padding: .6rem 1rem;
  background: var(--accent); color: #06240f; font-weight: 600; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.pick-banner .link-btn { color: #06240f; text-decoration: underline; }
.pick-banner #build-by-delta { background: var(--bg); color: var(--text); }
.strat-builder { display: flex; align-items: center; gap: .8rem; margin: .6rem 0; flex-wrap: wrap; }
.strat-builder label { display: flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); }
table.chain td.strike { cursor: pointer; }
table.chain td.strike.picked { outline: 2px solid var(--accent); outline-offset: -2px; }
.strat { background: var(--panel); border: 1px solid #2a3340; border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.strat-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem; }
.strat-label { font-size: 1.1rem; font-weight: 700; }
.strat-head .greeks { margin-left: auto; }
.strat-pnl { font-weight: 700; font-variant-numeric: tabular-nums; padding: .1rem .5rem; border-radius: 6px; }
.strat-pnl.lvl-info { color: var(--accent); background: rgba(34, 197, 94, .12); }
.strat-pnl.lvl-urgent { color: var(--urgent); background: rgba(239, 68, 68, .12); }
td.lvl-info { color: var(--accent); }
.strat-roll { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid #2a3340; display: flex; flex-direction: column; gap: .5rem; }
.strat-roll form { display: flex; gap: .8rem; align-items: end; flex-wrap: wrap; }
.strat-actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.strat-roll label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: .2rem; }
.account {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: .9rem 1.4rem; padding: 1rem 1.2rem; margin-bottom: 1rem;
  background: var(--panel); border-radius: 10px; border: 1px solid #2a3340;
}
.acct-metric { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.acct-metric .lbl { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; text-wrap: balance; }
.acct-metric .val { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.acct-metric .val small { color: var(--muted); font-size: .75rem; font-weight: 400; }
/* Greeks span the full width as a tidy footer row rather than wrapping mid-grid. */
.acct-metric.greeks-cell {
  grid-column: 1 / -1; margin-top: .1rem; padding-top: .7rem; border-top: 1px solid #2a3340;
}
.acct-metric.greeks-cell .val { color: var(--info); font-size: 1rem; }
.acct-metric.pnl-cell .val { font-size: 1.35rem; }
.val.pnl-pos { color: var(--accent); }
.val.pnl-neg { color: var(--urgent); }
/* Book — open positions grouped by underlying with subtotals. */
.book-total { display: flex; flex-wrap: wrap; gap: 1.5rem; padding: .9rem 1.2rem; margin-bottom: 1.2rem;
  background: var(--panel); border-radius: 10px; border: 1px solid #2a3340; }
.bt-cell { display: flex; flex-direction: column; gap: .15rem; }
.bt-cell .lbl { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.bt-cell .val { font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.book-group { background: var(--panel); border: 1px solid #2a3340; border-radius: 10px;
  margin-bottom: .8rem; overflow: hidden; }
.book-group > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline;
  gap: .8rem; padding: .7rem 1rem; }
.book-group > summary::-webkit-details-marker { display: none; }
.book-group > summary::before { content: "▸"; color: var(--muted); font-size: .8rem; }
.book-group[open] > summary::before { content: "▾"; }
.book-group > summary:hover { background: rgba(255,255,255,.02); }
.bg-sym { font-weight: 700; font-size: 1.05rem; }
.bg-sub { font-size: .8rem; }
.bg-qty { font-weight: 600; font-variant-numeric: tabular-nums; }
.bg-pnl { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.book-legs { margin: 0; border-top: 1px solid #2a3340; }
.book-legs th { font-size: .72rem; }
.book-legs td, .book-legs th { padding: .4rem 1rem; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.card { background: var(--panel); border-radius: 10px; padding: 1rem; border-left: 4px solid var(--muted); }
.card .num { font-size: 1.8rem; font-weight: 700; display: block; }

/* Expiration timeline ("roll radar") — positions on a today→furthest-expiry axis,
   colored by urgency. Status colors carry a legend; labels never rely on color alone. */
.timeline { padding: 1rem 1.2rem 1.3rem; margin-bottom: 1.5rem; }
.tl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.tl-head h2 { margin: 0; }
.tl-legend { display: flex; gap: 1rem; font-size: .75rem; }
.tl-key { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); }
.tl-key::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.tl-key.lvl-urgent::before { background: var(--urgent); }
.tl-key.lvl-warn::before { background: var(--warn); }
.tl-key.lvl-info::before { background: var(--info); }
.tl-track { position: relative; margin-top: 1.6rem; height: calc(var(--lanes) * 32px + 46px); }
.tl-axis { position: absolute; left: 0; right: 0; bottom: 26px; height: 2px; background: #2a3340; }
.tl-month { position: absolute; bottom: 4px; transform: translateX(-50%); color: var(--muted);
  font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; }
.tl-month::before { content: ""; position: absolute; left: 50%; bottom: 18px; width: 1px; height: 8px;
  background: #2a3340; }
/* Each marker: a dot on the axis, a stem whose height = its lane, and a label on top. */
.tl-marker { position: absolute; bottom: 20px; transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; align-items: center; }
.tl-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--muted);
  border: 2px solid var(--panel); box-shadow: 0 0 0 1px #2a3340; }
.tl-stem { width: 2px; background: #2a3340; height: calc(var(--lane) * 32px + 8px); }
.tl-marker.lvl-urgent .tl-dot { background: var(--urgent); }
.tl-marker.lvl-warn .tl-dot { background: var(--warn); }
.tl-marker.lvl-info .tl-dot { background: var(--info); }
.tl-marker.lvl-expired .tl-dot { background: var(--expired); }
.tl-label { display: flex; align-items: center; gap: .3rem; white-space: nowrap;
  padding: .15rem .45rem; background: var(--bg); border: 1px solid #2a3340; border-radius: 6px;
  font-size: .72rem; border-left-width: 3px; }
.tl-marker.lvl-urgent .tl-label { border-left-color: var(--urgent); }
.tl-marker.lvl-warn .tl-label { border-left-color: var(--warn); }
.tl-marker.lvl-info .tl-label { border-left-color: var(--info); }
.tl-marker.lvl-expired .tl-label { border-left-color: var(--expired); }
.tl-chip { font-weight: 600; }
.tl-dte { color: var(--muted); }
/* Per-marker hover/focus tooltip: the legs expiring that day + their P&L. */
.tl-tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 6px;
  background: #0b0e12; border: 1px solid #2a3340; border-radius: 8px; padding: .5rem .6rem;
  min-width: 170px; opacity: 0; pointer-events: none; transition: opacity .1s; z-index: 6;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.tl-marker:hover .tl-tip, .tl-marker:focus .tl-tip, .tl-marker:focus-within .tl-tip { opacity: 1; }
.tl-tip strong { display: block; margin-bottom: .35rem; font-size: .78rem; }
.tl-tip-row { display: flex; justify-content: space-between; gap: 1.2rem; font-size: .75rem; padding: .1rem 0; }
.tl-tip-row .muted { color: var(--muted); }

/* Earnings ⚡ ticks: sit on the axis line, below the position markers. Muted by
   default; "hot" (a position held through the report) glows in the warn color. */
.tl-earn { position: absolute; bottom: 21px; transform: translateX(-50%); z-index: 5;
  cursor: default; line-height: 1; }
.tl-earn-ico { font-size: .82rem; filter: grayscale(1) opacity(.55); }
.tl-earn.hot .tl-earn-ico { filter: none;
  text-shadow: 0 0 6px var(--warn), 0 0 2px var(--warn); }
.tl-earn .tl-earn-tip { min-width: 150px; }
.tl-earn:hover .tl-earn-tip, .tl-earn:focus .tl-earn-tip, .tl-earn:focus-within .tl-earn-tip { opacity: 1; }
.tl-key-earn { color: var(--warn); }
/* Ex-div ticks: sit a row above the ⚡ earnings ticks so both stay visible. */
.tl-div { position: absolute; bottom: 38px; transform: translateX(-50%); z-index: 5;
  cursor: default; line-height: 1; }
.tl-div-ico { font-size: .82rem; filter: grayscale(1) opacity(.55); }
.tl-div.hot .tl-div-ico { filter: none;
  text-shadow: 0 0 6px var(--info), 0 0 2px var(--info); }
.tl-div .tl-div-tip { min-width: 150px; }
.tl-div:hover .tl-div-tip, .tl-div:focus .tl-div-tip, .tl-div:focus-within .tl-div-tip { opacity: 1; }
.tl-key-div { color: var(--info); }

.toolbar { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }
button {
  background: var(--accent); color: #06240f; border: 0; border-radius: 8px;
  padding: .5rem .9rem; font-weight: 600; cursor: pointer;
}
button:disabled { opacity: .5; cursor: not-allowed; }
/* HTMX in-flight spinner: htmx adds .htmx-request to the triggering element. */
button.htmx-request, a.htmx-request { opacity: .7; cursor: wait; }
button.htmx-request::after, a.button-link.htmx-request::after {
  content: ""; display: inline-block; width: .8em; height: .8em; margin-left: .5em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: tc-spin .6s linear infinite; vertical-align: -1px;
}
@keyframes tc-spin { to { transform: rotate(360deg); } }
button.danger { background: var(--urgent); color: #fff; padding: .2rem .5rem; }
/* Notification toggle: clearly distinct off (muted/outline) vs on (green). */
#enable-push { background: var(--panel); color: var(--text); border: 1px solid #2a3340; }
#enable-push.is-on { background: var(--accent); color: #06240f; border: 0; }

/* "Mark all read" — secondary, sits beside the Notifications heading. */
.mark-all { float: right; font-size: .8rem; background: var(--panel); color: var(--text); border: 1px solid #2a3340; }

/* Unread-count badge on the Notifications nav link. */
.nav-badge {
  display: inline-block; min-width: 1.1em; padding: 0 .35em; margin-left: .25em;
  background: var(--urgent); color: #fff; border-radius: 999px;
  font-size: .72rem; font-weight: 700; line-height: 1.4; text-align: center;
  vertical-align: 1px;
}

/* In-app alert toasts — bottom-left ("left tail" = tail risk). */
#tc-toasts {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 9999;
  display: flex; flex-direction: column-reverse; gap: .5rem; max-width: 340px;
}
.tc-toast {
  position: relative; background: var(--panel); color: var(--text);
  border: 1px solid #2a3340; border-left: 4px solid var(--urgent);
  border-radius: 8px; padding: .6rem 1.8rem .6rem .8rem; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  animation: tc-toast-in .18s ease-out;
}
.tc-toast-title { font-weight: 700; margin-bottom: .15rem; }
.tc-toast-body { font-size: .9rem; opacity: .9; }
.tc-toast-close {
  position: absolute; top: .25rem; right: .25rem; background: transparent;
  color: var(--text); border: 0; padding: .1rem .3rem; font-size: .8rem; opacity: .6;
}
.tc-toast-close:hover { opacity: 1; }
@keyframes tc-toast-in { from { transform: translateX(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

.alert-list, .notif-list { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.alert, .notif {
  display: flex; align-items: center; gap: .8rem; padding: .6rem .9rem;
  background: var(--panel); border-radius: 8px; margin-bottom: .4rem; border-left: 4px solid var(--muted);
}
.notif { align-items: flex-start; }
.notif .body { flex: 1; }
.notif.read { opacity: .5; }
.badge {
  font-size: .75rem; text-transform: uppercase; font-weight: 700;
  padding: .15rem .5rem; border-radius: 999px; background: #2a3340; white-space: nowrap;
}
.headline { flex: 1; }
.qty { color: var(--muted); font-variant-numeric: tabular-nums; }
.alert-row { display: flex; align-items: center; gap: .75rem; width: 100%; flex-wrap: wrap; }
.leg { flex: 1; min-width: 150px; }
.leg strong { font-weight: 700; letter-spacing: .02em; }
.pos { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.greeks { color: var(--info); font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.roll-toggle { white-space: nowrap; }
.roll-form { display: none; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid #2a3340; }
.roll-form.open { display: block; }
.roll-form form { display: flex; gap: .8rem; align-items: end; flex-wrap: wrap; }
.roll-form label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: .2rem; }
.roll-actions { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.suggestions { margin-top: .6rem; }
.suggestions table { margin-top: .4rem; }
.score-bar { display: inline-block; width: 60px; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) var(--w, 0%), #2a3340 var(--w, 0%)); }
.order-type { display: inline-flex; align-items: center; gap: .6rem; margin-right: .6rem; }
.order-type label { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--muted); }
.roll-ticket { margin-top: .8rem; background: var(--bg); border: 1px solid #2a3340; border-radius: 8px; padding: .8rem; }
.roll-ticket h3 { margin: 0 0 .5rem; }
.alert.lvl-urgent, .alert.lvl-warn, .alert.lvl-expired, .alert.lvl-info { flex-direction: column; align-items: stretch; }

.lvl-info { border-left-color: var(--info); }
.lvl-warn { border-left-color: var(--warn); }
.lvl-urgent { border-left-color: var(--urgent); }
.lvl-expired { border-left-color: var(--expired); }
td.lvl-urgent { color: var(--urgent); font-weight: 700; }
td.lvl-warn { color: var(--warn); font-weight: 600; }
td.lvl-expired { color: var(--expired); }

.panel { background: var(--panel); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.panel summary { cursor: pointer; font-weight: 600; }
.grid-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-top: 1rem; }
.grid-form label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: .2rem; }
.grid-form .wide { grid-column: span 2; }
.grid-form button { grid-column: 1 / -1; }
/* Setups: full-width box, checkboxes laid out in a row that wraps cleanly. */
.grid-form .setups {
  grid-column: 1 / -1; border: 1px solid #2a3340; border-radius: 8px;
  padding: .5rem .8rem; display: flex; flex-wrap: wrap; gap: .4rem 1.4rem;
}
.grid-form .setups legend { color: var(--muted); font-size: .8rem; padding: 0 .3rem; }
.grid-form .setups label {
  flex-direction: row; align-items: center; gap: .35rem; white-space: nowrap;
}
/* PMCC / diagonal controls: a contained box, only shown when the setup is picked. */
.grid-form .pmcc-fields {
  grid-column: 1 / -1; border: 1px solid #2a3340; border-radius: 8px;
  padding: .6rem .8rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem .8rem;
}
.grid-form .pmcc-fields[hidden] { display: none; }
.grid-form .pmcc-fields legend { color: var(--muted); font-size: .8rem; padding: 0 .3rem; }
.grid-form .pmcc-fields label.inline {
  grid-column: 1 / -1; flex-direction: row; align-items: center; gap: .4rem; white-space: normal;
}
/* Paste-a-strategy: keep the textarea full-width and readable. */
.paste-strategy { margin: 1rem 0 .2rem; }
.paste-strategy summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.paste-strategy textarea {
  width: 100%; margin: .6rem 0 .4rem; font-family: inherit; font-size: .85rem;
  padding: .5rem .6rem; box-sizing: border-box;
}
.parsed-summary { margin: .8rem 0; }
.parsed-list { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .85rem; color: var(--muted); }
.parsed-list strong { color: var(--fg, inherit); }
/* Watchlist: one tidy row per name with a small inline remove button. */
.watchlist { list-style: none; padding: 0; margin: .6rem 0 0; }
.watchlist li { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; }
.watchlist .wl-remove {
  background: transparent; color: var(--urgent); border: 0;
  padding: 0 .3rem; font-size: .85rem; line-height: 1; cursor: pointer; width: auto;
}
.watchlist .wl-remove:hover { color: #fff; }
/* Inline earnings-ticker override (e.g. a US ADR) — sits at the right of a row. */
.wl-earn { display: inline-flex; align-items: center; gap: .25rem; margin-left: auto; }
.wl-earn-ico { font-size: .72rem; filter: grayscale(1) opacity(.5); }
.wl-earn input { width: 5.5em; padding: .1rem .35rem; font-size: .72rem;
  background: var(--bg); border: 1px solid #2a3340; border-radius: 5px; color: inherit;
  text-transform: uppercase; }
.wl-earn input::placeholder { text-transform: none; color: var(--muted); opacity: .6; }
/* Second override input (ex-div) sits right after the earnings one, not auto-pushed. */
.wl-earn.wl-div { margin-left: .5rem; }
/* ── Scan results: a dense 16-column metrics grid, tuned for scannability. ── */
table.scan-results { font-size: .85rem; }
.scan-results th, .scan-results td { padding: .4rem .55rem; }
/* Numbers right-aligned so columns line up for comparison; identity + actions stay left. */
.scan-results th, .scan-results td { text-align: right; }
.scan-results th:nth-child(-n+3), .scan-results td:nth-child(-n+3),
.scan-results th:last-child, .scan-results td:last-child { text-align: left; }
/* Row banding + hover so a wide row reads as a single unit. */
.scan-results tbody tr:nth-child(odd) td { background: rgba(255, 255, 255, .025); }
.scan-results tbody tr:hover td { background: rgba(34, 197, 94, .10); }
/* Identity anchor: brighter, bold underlying so you never lose the row. */
.scan-results td:nth-child(1) { color: var(--text); font-weight: 700; }
.scan-results td:nth-child(2) { color: var(--text); }
/* Headers: brighter + set apart from the muted intro line. */
.scan-results thead th {
  color: var(--text); border-bottom: 2px solid #2a3340;
  text-transform: uppercase; font-size: .72rem; letter-spacing: .03em;
}
/* Spotlight the ranking column (Score). */
.scan-results td:nth-child(16) { color: var(--accent); font-weight: 700; }
/* Ex-div early-assignment risk on a short call. */
.scan-results td.exdiv-hot { color: var(--info); font-weight: 600; white-space: nowrap; }
/* PMCC sub-row reads as a continuation of the row above it. */
.scan-results tr.pmcc-detail td {
  background: rgba(59, 130, 246, .06); text-align: left; font-size: .8rem;
}
/* Highlight a candidate held through its earnings report. */
.scan-results td.earn-hot { color: var(--warn); font-weight: 600; white-space: nowrap; }
/* Sortable scan headers show a pointer + subtle affordance. */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--info); }

/* Dashboard: alerts (left) beside a working-orders + notifications sidebar (right). */
.dash-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 1.2rem; align-items: start; margin-top: 1rem; }
.dash-main { min-width: 0; }
.dash-main > section { margin-bottom: 1rem; }
.dash-side { display: flex; flex-direction: column; gap: 1rem; }
.dash-panel { overflow-x: auto; }
.dash-panel h2 { margin-top: 0; font-size: 1.05rem; }
.dash-panel .nav-mini { font-size: .75rem; font-weight: 400; margin-left: .4rem; }
.notif-list.compact { margin: 0; padding: 0; list-style: none; }
.notif-list.compact .notif { padding: .35rem 0; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

/* User manual (/help). */
.manual { max-width: 820px; }
.manual h2 { margin-top: 2rem; border-top: 1px solid #2a3340; padding-top: 1rem; }
.manual h3 { margin-top: 1.2rem; }
.manual section { scroll-margin-top: 1rem; }
.manual ul, .manual ol { line-height: 1.6; }
.manual .toc { background: var(--panel); border: 1px solid #2a3340; border-radius: 10px; padding: .8rem 1.2rem; margin: 1.2rem 0; }
.manual .toc ol { margin: .4rem 0 0; padding-left: 1.2rem; }
.manual .toc a { color: var(--accent); }
.glossary dt { font-weight: 700; margin-top: .5rem; }
.glossary dd { margin: 0 0 .2rem; color: var(--muted); }

/* Tabbed panels (Scan page). */
.tabbar { display: flex; flex-wrap: wrap; gap: .2rem; border-bottom: 1px solid #2a3340; margin: 1rem 0 1.2rem; }
.tabbar button {
  background: transparent; color: var(--muted); border: 0; border-radius: 0;
  border-bottom: 2px solid transparent; padding: .55rem 1rem; font-weight: 600;
}
.tabbar button:hover { color: var(--text); }
.tabbar button.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
input, select {
  background: var(--bg); color: var(--text); border: 1px solid #2a3340;
  border-radius: 6px; padding: .4rem .5rem; font: inherit;
}
form.inline { display: inline; margin: 0; }

table.positions { width: 100%; border-collapse: collapse; margin-top: 1rem; }
table.positions th, table.positions td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid #2a3340; }
table.positions th { color: var(--muted); font-weight: 600; font-size: .85rem; }
table.positions td { font-variant-numeric: tabular-nums; }

/* Auth */
.topbar .logout-form { display: flex; align-items: center; gap: .6rem; }
.button-link { display: inline-block; background: var(--accent); color: #06240f; border-radius: 8px; padding: .5rem .9rem; font-weight: 600; }
.button-link:hover { text-decoration: none; filter: brightness(1.05); }
.link-btn { background: none; color: var(--muted); padding: .2rem .4rem; font-weight: 600; }
.link-btn:hover { color: var(--text); text-decoration: underline; }
.auth-card {
  max-width: 360px; margin: 4rem auto; background: var(--panel);
  padding: 2rem; border-radius: 12px; border: 1px solid #2a3340;
}
.auth-card h1 { margin-top: 0; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.2rem; }
.auth-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--muted); }
.auth-error {
  background: rgba(239, 68, 68, .15); color: #fca5a5;
  padding: .6rem .8rem; border-radius: 8px; border-left: 4px solid var(--urgent);
}

@media (max-width: 700px) {
  .summary, .grid-form { grid-template-columns: repeat(2, 1fr); }
}

/* --- Calendar (year agenda) ------------------------------------------- */
.cal-add { margin: 1rem 0 1.4rem; }
.cal-add > summary { cursor: pointer; color: var(--accent); font-weight: 600; width: max-content; }
.cal-add-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .8rem; }
.cal-add-form input[type="text"] { min-width: 10rem; }
.cal-add-form input, .cal-add-form textarea, .cal-lead input, .cal-add-lead input {
  background: var(--bg); color: var(--text); border: 1px solid #2a3340;
  border-radius: 8px; padding: .4rem .55rem;
}
.cal-add-form input[type="number"], .cal-lead input { width: 3.4rem; }
.cal-add-form textarea {
  flex-basis: 100%; width: 100%; min-height: 3.6rem; resize: vertical;
  font: inherit; line-height: 1.4;
}
.cal-add-notify, .cal-add-lead { display: inline-flex; align-items: center; gap: .35rem; }

.cal-yearnav { display: flex; align-items: center; gap: 1rem; margin: 0 0 1rem; }
.cal-year { margin: 0; font-size: 1.4rem; }
.yearnav-btn { background: var(--panel); color: var(--text); border: 1px solid #2a3340; font-size: .85rem; }
.yearnav-btn:hover { border-color: var(--accent); }

.cal-yearnav .cal-refresh { margin-left: auto; }

/* Month-jump strip: quick anchors to each populated month. */
.cal-jump { display: flex; flex-wrap: wrap; gap: .3rem .5rem; margin: 0 0 1.2rem; font-size: .82rem; }
.cal-jump a { padding: .1rem .3rem; border-radius: 5px; }
.cal-jump a:hover { background: var(--panel); text-decoration: none; }
.cal-jump span { padding: .1rem .3rem; opacity: .45; }

.cal-month { margin-bottom: 1.4rem; scroll-margin-top: 1rem; border-radius: 8px; padding: .15rem .5rem; margin-left: -.5rem; }
/* Jumping to a month flashes it, so the jump is obvious even when the target is
   already on screen (short years barely scroll). */
.cal-month:target { animation: cal-flash 1.5s ease-out; }
.cal-month:target > .cal-month-h { color: var(--accent); border-bottom-color: var(--accent); }
@keyframes cal-flash {
  0%, 30% { background: rgba(34, 197, 94, .14); }
  100% { background: transparent; }
}
.cal-month-h {
  margin: 0 0 .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); border-bottom: 1px solid #2a3340; padding-bottom: .3rem;
}
.cal-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.cal-event {
  display: flex; align-items: center; gap: .8rem;
  background: var(--panel); border-radius: 8px; padding: .5rem .8rem;
  border-left: 4px solid var(--muted);
}
.cal-event.lvl-warn { border-left-color: var(--warn); }
.cal-event.lvl-info { border-left-color: var(--info); }
.cal-date { display: flex; flex-direction: column; align-items: center; min-width: 2.4rem; line-height: 1.1; }
.cal-day { font-size: 1.2rem; font-weight: 700; }
.cal-dow { font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; }
.cal-icon { font-size: 1.1rem; }
.cal-body { flex: 1; min-width: 0; }
.cal-auto { background: var(--expired); font-size: .6rem; margin-left: .4rem; vertical-align: 1px; }
.cal-notes { margin-top: .15rem; }
.cal-notify { display: inline-flex; align-items: center; gap: .5rem; }
.cal-lead { display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; }
.cal-actions { display: inline-flex; align-items: center; gap: .35rem; }
.cal-del { margin: 0; }
.cal-del .danger { padding: .25rem .5rem; font-size: .85rem; }
.cal-edit-btn {
  background: var(--panel); color: var(--text); border: 1px solid #2a3340;
  padding: .25rem .5rem; font-size: .85rem;
}
.cal-edit-btn:hover { border-color: var(--accent); }

/* Inline edit form (replaces a row while editing). */
.cal-editing { display: block; }
.cal-edit-form { display: flex; flex-direction: column; gap: .6rem; }
.cal-edit-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.cal-edit-row input[type="text"] { flex: 1; min-width: 12rem; }
.cal-edit-form input, .cal-edit-form textarea {
  background: var(--bg); color: var(--text); border: 1px solid #2a3340;
  border-radius: 8px; padding: .4rem .55rem; font: inherit;
}
.cal-edit-form textarea { width: 100%; min-height: 3.6rem; resize: vertical; line-height: 1.4; }
.cal-edit-actions { display: flex; gap: .6rem; }

@media (max-width: 700px) {
  .cal-event { flex-wrap: wrap; }
  .cal-body { flex-basis: 100%; order: 3; }
}
