/* StarStock — light "financial research" theme (2026-09-06 redesign).
   Direction approved from the Fidelity-style mockup: light grey canvas, white
   card panels, one humanist sans (Source Sans 3) with a wide weight range, and
   a strict semantic palette:
     money  = ink black (the confident figure)
     green  = up / good / fresh
     red    = down / bad / stale
     blue   = links + the price chart's sell line
   Committed single (light) theme, like the reference; all colours explicit.
   Bright gold reads as invisible on light, which is why money is ink here. */
:root {
  color-scheme: light;
  --bg:        #eceef1;   /* light grey app ground so white cards lift off it */
  --panel:     #ffffff;
  --ctrl:      #ffffff;   /* raised control faces (buttons, inputs on focus) */
  --warm:      #f7f7f4;   /* warm off-white footer/section ground */
  --cool:      #f4f6f8;   /* cool light grey: rails, table head, hover */
  --ink:       #1c1e21;   /* text + money values */
  --muted:     #5c646e;
  --faint:     #8b939d;
  --line:      #e4e7ea;
  --line-2:    #eef0f2;
  --green:     #2f8a3e;   /* brand + up/positive */
  --green-ink: #1f7a37;   /* positive text (stronger contrast on white) */
  --green-bg:  #eef6ef;
  --red:       #c9302a;   /* down/negative */
  --red-bg:    #fbeeed;
  --blue:      #1668c2;   /* links + chart sell line */
  --blue-soft: #eaf1fa;
  --amber:     #d9982f;   /* favourite star only */
  --focus:     #1668c2;
  --shadow:    0 1px 2px rgba(20,25,35,.04), 0 12px 30px -20px rgba(20,25,35,.22);
  --radius:    10px;
  font-synthesis: none;
}

/* ---------- dark theme ----------
   Same semantic roles as the light theme, just re-pointed: near-black app ground,
   raised charcoal cards, ink -> near-white text/money, and slightly brighter
   green/red/blue so they stay legible on dark. Applied when app.js/theme.js sets
   data-theme="dark" on <html>; every colour above is a token, so only the tokens
   change. A few hardcoded light values elsewhere are patched further down. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #14171c;
  --panel:     #1c2027;
  --ctrl:      #262c34;
  --warm:      #171a20;
  --cool:      #232830;
  --ink:       #e7ebf0;
  --muted:     #9aa4b0;
  --faint:     #6b7480;
  --line:      #2b313a;
  --line-2:    #23282f;
  --green:     #35a34a;
  --green-ink: #56c06e;
  --green-bg:  #16281b;
  --red:       #e0625c;
  --red-bg:    #2a1917;
  --blue:      #5aa2e8;
  --blue-soft: #16273a;
  --amber:     #e0a53a;
  --focus:     #5aa2e8;
  --shadow:    0 1px 2px rgba(0,0,0,.30), 0 12px 30px -20px rgba(0,0,0,.65);
}
/* Patches for a handful of light hex values hardcoded in element rules. */
:root[data-theme="dark"] .grp-row td:hover { background: #2a3039 !important; }
:root[data-theme="dark"] .btn:hover { border-color: #3a4149; }
:root[data-theme="dark"] .fav-star { color: #49515b; }
:root[data-theme="dark"] .pstatus #ptext { text-decoration-color: #3a4149; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
header.bar { border-bottom: 1px solid var(--line); background: var(--panel); }
.bar-inner { display: flex; align-items: center; gap: 16px; padding: 15px 24px; }
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
/* Hidden by default; app.js reveals it only once a real logo.svg loads, so no
   broken-image / alt-text flash before Ben's logo exists. */
.brand-logo { width: 34px; height: 34px; flex: none; border-radius: 8px; object-fit: contain; display: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.08; }
.brand h1 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.brand h1 .k { color: inherit; }
.brand .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.pstatus {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer; padding: 4px 6px;
  border-radius: 6px; transition: background .15s, color .15s;
}
.pstatus:hover { background: var(--cool); color: var(--ink); }
.pstatus #ptext { text-decoration: underline; text-decoration-color: #c3cad2; text-underline-offset: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.pstatus.live .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.pstatus.stale .dot { background: var(--amber); }
.pstatus.off .dot { background: var(--red); }

.support-btn { flex: none; text-decoration: none; white-space: nowrap; }

/* light/dark toggle button (sits at the far right of the header) */
.theme-toggle {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel); color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.theme-toggle:hover { background: var(--cool); color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .ico-sun { display: none; }
.theme-toggle .ico-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }

/* ---------- sub-header: nav tabs + search ---------- */
.subbar { border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 20; }
.subbar-inner { display: flex; align-items: center; gap: 22px; }
.tabs { display: flex; gap: 22px; }
.tab {
  font-size: 14.5px; font-weight: 600; color: var(--muted); padding: 13px 2px;
  border-bottom: 2.5px solid transparent; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--green); }
.tab .tab-star { color: var(--amber); font-size: 12px; }
/* Site-wide price-scope toggle, lives in the subbar (right side, before search). */
.scope-ctl { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.scope-ctl .scope-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.search { position: relative; display: flex; align-items: center; padding: 8px 0; min-width: 0; }
.search .ico { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
#q {
  width: 300px; max-width: 44vw; padding: 9px 34px 9px 36px; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--cool); border: 1px solid var(--line); border-radius: 8px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
#q::placeholder { color: var(--faint); }
#q:focus { border-color: var(--blue); background: var(--ctrl); box-shadow: 0 0 0 3px var(--blue-soft); }
.clearbtn { position: absolute; right: 8px; border: none; background: transparent; cursor: pointer; color: var(--faint); font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 6px; display: none; }
.clearbtn:hover { color: var(--ink); background: var(--line-2); }

/* ---------- whole-market export bar (under the sub-header) ---------- */
.exportbar { border-bottom: 1px solid var(--line); background: var(--warm); }
.exportbar-inner { display: flex; align-items: center; gap: 12px; padding: 10px 24px; flex-wrap: wrap; }
.export-title { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.export-title .scope-suffix { color: var(--green-ink); }
.exportbar .btn { padding: 7px 13px; font-size: 13px; }
.exportbar .copy-msg { margin-left: 2px; }
@media (max-width: 720px) {
  /* On phones the buttons wrap to their own row; give the bar real bottom room
     and separation so the browse content below starts clearly lower, not tucked
     right under the buttons. */
  .exportbar-inner { gap: 8px; padding: 9px 16px 12px; }
  .export-title { width: 100%; }
  .exportbar { margin-bottom: 10px; }
}

main { padding: 22px 0 90px; }

/* first-run explainer on the browse page */
.intro { color: var(--muted); font-size: 14px; max-width: 68ch; margin: 0 0 18px; line-height: 1.55; }
.intro b { color: var(--ink); font-weight: 700; }

/* ---------- browse: left rail + results ---------- */
.layout { display: grid; grid-template-columns: 236px 1fr; gap: 24px; align-items: start; }
.rail { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); box-shadow: var(--shadow); position: sticky; top: 66px; }
.rail-head { padding: 11px 14px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 700; background: var(--cool); border-bottom: 1px solid var(--line); }
.rail-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 10px 14px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; border: none; border-left: 3px solid transparent; background: transparent; }
.rail-item:hover { background: var(--cool); }
.rail-item.on { border-left-color: var(--green); background: var(--green-bg); font-weight: 700; }
.rail-item .n { color: var(--faint); font-size: 12.5px; font-weight: 400; }
.rail-item.on .n { color: var(--green-ink); }

.results { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.results-top { padding: 15px 18px 13px; border-bottom: 1px solid var(--line); }
.results-top h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.results-top .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
/* small "(Jita)"/"(Everywhere)" qualifier next to Best sell/Best buy headers */
table.mkt thead th .scope-suffix { text-transform: none; font-weight: 400; color: var(--muted); letter-spacing: 0; }

/* subcategory accordion inside the results panel */
.sub { border-top: 1px solid var(--line); }
.sub:first-child { border-top: none; }
.sub-head { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px 18px; font: inherit; font-size: 15.5px; font-weight: 700; color: var(--ink); background: transparent; border: none; cursor: pointer; }
.sub-head:hover { background: var(--cool); }
.sub-head .caret { color: var(--faint); font-size: 11px; transition: transform .15s; }
.sub-head.open .caret { transform: rotate(90deg); color: var(--green); }
.sub-head .sname { flex: 1; text-transform: capitalize; }
.sub-head .count { color: var(--faint); font-size: 12.5px; font-weight: 400; }
.sub-body { display: none; }
.sub-body.open { display: block; }

/* ---------- shared market table ---------- */
.tbl-scroll { width: 100%; overflow-x: auto; }
table.mkt { width: 100%; border-collapse: collapse; font-size: 14px; }
table.mkt thead th {
  text-align: right; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--faint);
  font-weight: 700; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel); white-space: nowrap; position: sticky; top: 0;
}
table.mkt thead th:first-child { text-align: left; }
table.mkt tbody td { padding: 10px 16px; border-bottom: 1px solid var(--line-2); text-align: right; white-space: nowrap; }
table.mkt tbody td:first-child { text-align: left; }
table.mkt tbody tr { cursor: pointer; }
table.mkt tbody tr:hover td { background: var(--cool); }
.grp-row td { background: var(--warm) !important; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 16px; cursor: pointer; }
.grp-row td:hover { background: #edeee9 !important; }
.grp-row .caret { display: inline-block; font-size: 9px; color: var(--faint); margin-right: 9px; transition: transform .15s, color .15s; }
.grp-row .gcount { color: var(--faint); font-weight: 600; margin-left: 8px; }
/* each group's item rows are hidden until its header row toggles the tbody open */
tbody.grp-tb .item-tr { display: none; }
tbody.grp-tb.open .item-tr { display: table-row; }
tbody.grp-tb.open .grp-row .caret { transform: rotate(90deg); color: var(--green); }
.it-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.it-name .nm-main { min-width: 0; }
.it-name a { font-weight: 600; }
.it-name .nm-path { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42ch; }
.money { color: var(--ink); font-weight: 600; }
.money.dim { color: var(--muted); font-weight: 500; }
.money.none { color: var(--faint); font-weight: 400; }
.spread { color: var(--green-ink); font-weight: 600; }
.spread.dn { color: var(--red); }
.spread.none { color: var(--faint); font-weight: 400; }
.iu { font-size: 10.5px; font-weight: 400; color: var(--faint); margin-left: 2px; }
.upd { color: var(--muted); font-weight: 500; }
.upd.fresh { color: var(--green-ink); }
.upd.stale { color: var(--red); }
.fav-star { border: none; background: transparent; cursor: pointer; color: #cfd4da; font-size: 16px; line-height: 1; padding: 2px 4px; border-radius: 5px; flex: none; transition: color .12s, background .12s; }
.fav-star:hover { color: var(--amber); background: var(--line-2); }
.fav-star.on { color: var(--amber); }
.it-name .fav-star { margin-left: 2px; }
.it-ico { width: 22px; height: 22px; }
.icon { flex: none; border-radius: 5px; object-fit: cover; background: var(--cool); border: 1px solid var(--line); vertical-align: middle; }
/* Near-white line-art icons (implant boosts etc.) get a dark tile like the game's
   inventory slot so they don't wash out on the light theme. Tagged in app.js. */
.icon-dark { background: #2b2f36; border-color: #2b2f36; }
.icon-placeholder { display: inline-block; background: var(--cool); border: 1px solid var(--line); border-radius: 5px; }

/* hide secondary columns on narrow screens */
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .bar-inner { padding: 13px 16px; }
  /* Header gets tight with brand + status + support button + theme toggle on
     narrow phones; shrink the support button rather than let it force wrap. */
  .support-btn { padding: 7px 10px; font-size: 12px; }
  /* Stack the sub-header so tabs + search never force the page wider than the
     screen (that horizontal overflow was cutting off the search box and the
     price column on phones). Search gets its own full-width row above the tabs;
     the tabs scroll sideways within their own row if they don't all fit. */
  .subbar-inner { flex-wrap: wrap; gap: 0; }
  .search { order: -1; width: 100%; margin-left: 0; padding: 10px 0 8px; }
  #q { width: 100%; max-width: none; }
  .tabs { width: 100%; overflow-x: auto; gap: 20px; padding-bottom: 1px; -webkit-overflow-scrolling: touch; }
  .tab { padding-top: 4px; }
  /* Scope toggle gets its own full-width row (below the tabs) so it stays fully
     visible and tappable on phones instead of overflowing the tabs row. */
  .scope-ctl { width: 100%; margin: 0; padding: 9px 0 10px; }

  .layout { grid-template-columns: 1fr; }
  .rail { position: static; }
  .rail-list { display: flex; overflow-x: auto; gap: 0; -webkit-overflow-scrolling: touch; }
  /* Taller, roomier tabs on phones - the default 10px/14px chip reads as a thin
     strip once it's a horizontal scroller, so bump the padding and text for an
     easier read and a bigger tap target. */
  .rail-list .rail-item { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; padding: 14px 18px; font-size: 15px; }
  .rail-list .rail-item.on { border-left: none; border-bottom-color: var(--green); }
  .col-buy, .col-spread { display: none; }
  table.mkt thead th, table.mkt tbody td { padding-left: 12px; padding-right: 12px; }
  /* Cap the item name so a long name can't eat the whole row and push the
     "Updated" age off the right edge - it truncates with an ellipsis instead,
     leaving the price and the age both on screen without sideways scrolling. */
  .it-name .nm-main { min-width: 0; }
  .it-name .nm-main a { display: inline-block; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
  .it-name .nm-path { max-width: 42vw; }
}

/* section headings reused for favourites / recent / search */
.list-head { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; padding: 0 2px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.list-head .star { color: var(--amber); }
.list-head .count { color: var(--faint); font-weight: 600; }
.panel-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }

.hint { color: var(--muted); font-size: 14px; padding: 14px 18px; }
.error-msg { color: var(--red); font-size: 14px; padding: 14px 18px; }
.empty { text-align: center; padding: 66px 20px; color: var(--muted); }
.empty .big { font-size: 20px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }

/* ---------- item detail (Fidelity-account style card) ---------- */
.detail-wrap { max-width: 660px; margin: 0 auto; }
.back-link { display: inline-block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
.back-link:hover { color: var(--ink); text-decoration: none; }
.d-card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); overflow: hidden; box-shadow: var(--shadow); }
.d-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.d-ico { width: 50px; height: 50px; }
.d-head h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.d-head .d-path { font-size: 13px; color: var(--muted); margin-top: 2px; }
.d-head .d-updated { font-size: 12px; color: var(--faint); margin-top: 4px; }
.d-head .d-updated .upd { font-weight: 600; }
.d-head .fav-star.big { margin-left: auto; font-size: 24px; align-self: flex-start; padding: 4px 6px; }

.d-value { padding: 22px 20px 6px; }
.d-value .lbl { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.d-value .big { font-size: 42px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; margin-top: 4px; color: var(--ink); }
.d-value .big.none { color: var(--muted); font-size: 26px; }
.d-value .big .u { font-size: 17px; font-weight: 600; color: var(--muted); margin-left: 8px; }

.gains { display: flex; gap: 40px; padding: 6px 20px 20px; flex-wrap: wrap; }
.gain .v { font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.gain .v.up { color: var(--green-ink); }
.gain .v.dn { color: var(--red); }
.gain .v.flat { color: var(--muted); }
.gain .k { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 15px; background: var(--ctrl); border: none; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--green); color: #fff; }
.price-help { font-size: 12.5px; color: var(--muted); padding: 0 20px 12px; max-width: 52ch; }

/* ---- item detail: Price history / Order book tab strip ---- */
.d-tabs { display: flex; gap: 26px; padding: 0 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.d-tab { font: inherit; font-size: 14px; font-weight: 700; color: var(--muted); padding: 12px 0; margin-bottom: -1px; border: none; border-bottom: 2.5px solid transparent; background: transparent; cursor: pointer; }
.d-tab:hover { color: var(--ink); }
.d-tab.active { color: var(--ink); border-bottom-color: var(--green); }

.periods { display: flex; gap: 26px; padding: 0 20px; }
.period { font: inherit; font-size: 14px; font-weight: 700; color: var(--muted); padding: 11px 0; border: none; border-bottom: 2.5px solid transparent; background: transparent; cursor: pointer; }
.period:hover { color: var(--ink); }
.period.active { color: var(--ink); border-bottom-color: var(--green); }

.chart-pad { padding: 14px 12px 2px; }
.chart-wrap { position: relative; }
.chart-wrap svg { cursor: crosshair; touch-action: none; display: block; }
.chart-tip { position: absolute; top: 8px; pointer-events: none; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 132px; font-size: 12.5px; line-height: 1.5; box-shadow: var(--shadow); }
.chart-tip .t-date { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.chart-tip .t-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tip .t-k { font-weight: 700; }
.chart-tip .t-v { color: var(--ink); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 20px; justify-content: center; font-size: 12.5px; color: var(--muted); padding: 4px 0 14px; }
.legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 7px; }

/* Daily market-volume bars (below the price chart, inside the chart panel). */
.vol-section { border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 12px; }
.vol-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 20px; flex-wrap: wrap; }
.vol-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.vol-title #vol-scope-lbl { color: var(--muted); font-weight: 400; }
.vol-now { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vol-sub { font-size: 12.5px; color: var(--muted); padding: 2px 20px 0; }

.d-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.d-stat { padding: 14px 18px; min-width: 0; }
.d-stat + .d-stat { border-left: 1px solid var(--line); }
/* Labels stay one line (ellipsis if long) so all three values line up on one row. */
.d-stat .k { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-stat .v { font-size: 17px; font-weight: 700; margin-top: 5px; color: var(--ink); white-space: nowrap; }
.d-stat .v .s { font-size: 11.5px; color: var(--muted); font-weight: 400; margin-left: 4px; }
/* Exact ISK on desktop; the compact (2.97B) form is swapped in on phones below. */
.d-stat .v-short { display: none; }
.d-stat .v.pos { color: var(--green-ink); }
.d-stat .v.none { color: var(--muted); font-weight: 500; font-size: 15px; }

.d-actions { display: flex; gap: 10px; padding: 16px 18px; border-top: 1px solid var(--line); background: var(--warm); flex-wrap: wrap; align-items: center; }
.btn { font: inherit; font-size: 13.5px; font-weight: 700; padding: 9px 15px; border-radius: 8px; cursor: pointer; border: 1px solid var(--line); background: var(--ctrl); color: var(--ink); }
.btn:hover { border-color: #c7ccd2; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #276f33; border-color: #276f33; }
.copy-msg { font-size: 12.5px; color: var(--muted); }

/* ---------- "i" info button + popover (export explainers) ---------- */
.info-wrap { position: relative; display: inline-flex; align-items: center; }
.info-btn {
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--ctrl); color: var(--muted);
  font: italic 700 13px/1 Georgia, "Times New Roman", serif;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.info-btn:hover { color: var(--ink); border-color: #c7ccd2; }
.info-pop {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0;
  width: min(320px, 78vw); padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0,0,0,.16);
  font-size: 12.8px; line-height: 1.5; color: var(--muted); font-weight: 400;
  text-align: left; white-space: normal;
}
.info-pop p { margin: 0 0 8px; }
.info-pop p:last-child { margin-bottom: 0; }
.info-pop b { color: var(--ink); font-weight: 700; }
/* This button sits at the right edge of the export bar, so open the panel
   leftward (right-anchored) or it runs off the right of the screen on mobile. */
#export-all-info-pop { left: auto; right: 0; }
/* The item page's export bar sits at the BOTTOM of the card, so a downward
   popup drops off the bottom of the screen (forcing a scroll). Open it UPWARD
   (above the bar, always in view) and right-anchored so it stays on-screen on
   mobile; cap the height so a tiny landscape phone scrolls inside the popup
   rather than the whole page running off. */
#copy-info-pop {
  top: auto; bottom: calc(100% + 8px); left: auto; right: 0;
  max-height: min(70vh, 360px); overflow-y: auto;
}
/* On phones the "i" button sits mid-bar, so anchoring the popup to it (either
   edge) can run off the side of the screen. Pin it to the VIEWPORT instead:
   fixed, spanning the screen with a small margin each side, near the bottom —
   always fully on-screen and readable, no page scroll, no left/right overflow. */
@media (max-width: 640px) {
  #copy-info-pop {
    position: fixed;
    left: 12px; right: 12px; bottom: 14px; top: auto;
    width: auto; max-width: none;
    max-height: 70vh; overflow-y: auto;
  }
}
:root[data-theme="dark"] .info-btn:hover { border-color: #3a424c; }

.activity-badge { display: inline-block; font-size: 10.5px; letter-spacing: .03em; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; margin-left: 8px; vertical-align: middle; color: var(--muted); background: var(--cool); border: 1px solid var(--line); font-weight: 600; }
.activity-badge.live { color: var(--green-ink); border-color: #bfe0c5; background: var(--green-bg); }
.activity-badge.stale { color: var(--muted); }
.activity-badge.off { color: var(--red); border-color: #f0cfcd; background: var(--red-bg); }

@media (max-width: 520px) {
  .d-value .big { font-size: 36px; }
  .gains { gap: 28px; }
  .brand .sub { display: none; }
  /* Keep Best buy / Spread / Avg as one three-across row on phones: tighter cells
     and the compact ISK form (2.97B) so the values fit without wrapping. */
  .d-stat { padding: 12px 10px; }
  .d-stat .v { font-size: 15px; }
  .d-stat .v-full { display: none; }
  .d-stat .v-short { display: inline; }
}

footer.footer { border-top: 1px solid var(--line); color: var(--faint); font-size: 12.5px; text-align: center; padding: 24px; margin-top: 44px; }
footer.footer .legal { display: block; margin-top: 7px; font-size: 12px; color: var(--faint); }
footer.footer .legal a { color: var(--muted); }
footer.footer .legal a:hover { color: var(--ink); }

a:focus-visible, button:focus-visible, [tabindex]:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- order-book tab (item detail) ---------- */
.ob-body { padding: 14px 20px 20px; }
.ob-scope-note { color: var(--muted); font-size: 12.5px; margin: 12px 0 14px; }
.ob-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.ob-side-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.ob-side-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.ob-side-title.sell { color: var(--green-ink); }
.ob-side-title.buy { color: var(--blue); }
.ob-count { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--cool); border-radius: 999px; padding: 1px 8px; }
.ob-hint { margin-left: auto; font-size: 11.5px; color: var(--faint); }
.ob-empty { color: var(--muted); font-size: 13px; padding: 10px 0; }
.ob-scroll { max-height: 360px; overflow-y: auto; overflow-x: auto; border: 1px solid var(--line-2); border-radius: 8px; }
.ob-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ob-table thead th { position: sticky; top: 0; background: var(--cool); color: var(--muted); font-weight: 700; text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.ob-table th.num, .ob-table td.num { text-align: right; }
.ob-table td { padding: 6px 12px; border-bottom: 1px solid var(--line-2); }
.ob-table tbody tr:last-child td { border-bottom: 0; }
.ob-table tbody tr:hover td { background: var(--cool); }
.ob-loc { color: var(--ink); }
.ob-price { color: var(--ink); font-weight: 600; white-space: nowrap; }
.ob-price .s { color: var(--faint); font-weight: 400; font-size: 11px; }
@media (max-width: 720px) { .ob-grid { grid-template-columns: 1fr; gap: 26px; } .ob-body { padding: 14px 14px 16px; } .d-tabs, .periods { padding: 0 14px; gap: 20px; } }

/* ---------- item cart ---------- */
.cart-tools { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 2px 14px; }
.cart-paste { margin: 0 2px 16px; }
.cart-paste textarea { width: 100%; box-sizing: border-box; padding: 12px 14px; font: inherit; font-size: 13.5px; color: var(--ink); background: var(--cool); border: 1px solid var(--line); border-radius: 10px; outline: none; resize: vertical; line-height: 1.5; }
.cart-paste textarea:focus { border-color: var(--blue); background: var(--ctrl); box-shadow: 0 0 0 3px var(--blue-soft); }
.cart-paste-actions { display: flex; gap: 10px; margin-top: 10px; }
.cart-add { margin: 0 2px 16px; max-width: 460px; }
.cart-add-search { padding: 0; }
.cart-add-search input { width: 100%; box-sizing: border-box; padding: 9px 14px 9px 36px; font: inherit; font-size: 14px; color: var(--ink); background: var(--cool); border: 1px solid var(--line); border-radius: 8px; outline: none; }
.cart-add-search input:focus { border-color: var(--blue); background: var(--ctrl); box-shadow: 0 0 0 3px var(--blue-soft); }
.cart-add-results { margin-top: 6px; border-radius: 10px; overflow: hidden; }
.cart-add-results:not(:empty) { border: 1px solid var(--line); background: var(--panel); }
.cart-add-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 12px; border: none; border-bottom: 1px solid var(--line-2); background: transparent; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink); }
.cart-add-row:last-child { border-bottom: none; }
.cart-add-row:hover { background: var(--cool); }
.cart-add-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.cart-unresolved { margin: 0 2px 14px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--red); background: var(--red-bg); border-radius: 8px; font-size: 13px; color: var(--ink); }
.cart-unresolved ul { margin: 6px 0 0; padding-left: 20px; }
.cart-unresolved li { margin: 2px 0; }
table.cart-tbl tbody tr { cursor: default; }
table.cart-tbl tbody tr:hover td { background: transparent; }
.cart-qty { width: 108px; padding: 7px 9px; font: inherit; font-size: 13.5px; text-align: right; color: var(--ink); background: var(--cool); border: 1px solid var(--line); border-radius: 7px; outline: none; }
.cart-qty:focus { border-color: var(--blue); background: var(--ctrl); box-shadow: 0 0 0 3px var(--blue-soft); }
.cart-x-h { width: 34px; }
.cart-x { border: none; background: transparent; color: var(--faint); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.cart-x:hover { color: var(--red); background: var(--red-bg); }
.cart-total { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.cart-total-label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.cart-total-label .scope-suffix { color: var(--green-ink); text-transform: none; letter-spacing: 0; font-weight: 600; }
.cart-total-val { font-size: 21px; font-weight: 800; color: var(--ink); }
.cart-total-val .iu { font-size: 12px; }
.cart-note { margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); }
.cart-help-pop { width: min(380px, 88vw); }
.cart-help-img { display: block; width: 100%; border-radius: 8px; border: 1px solid var(--line); margin: 4px 0 10px; }
