/* ==========================================================================
   Auction Oracle — application shell and "Forever" design system (2026-11-13 redesign)

   Shell (every theme): one top bar with the FOUR sections (Overview · Market · Trading · Crafting), search,
   market, alerts, a gear menu for all configuration; a tab strip with the pages of the active section; a compact
   page header; the page. Mobile: the same top bar without section names + a bottom bar with the four sections.

   "Forever" theme (default): midnight charcoal surfaces in three elevations, warm gold used sparingly for actions
   and focus, emerald for gains, muted red for losses. Inter for text, JetBrains Mono for figures. Component rules
   shared with Comptoir (comptoir.css matches both themes); only tokens and refinements live here.
   ========================================================================== */

/* ---------- design tokens: Forever ---------- */
[data-theme="forever"] {
  color-scheme: dark;
  /* surfaces: canvas < panel < raised (popovers, hover rows) */
  --bg: #0b0d12; --bg2: #0f1218; --panel: #12151c; --panel-solid: #12151c; --panel2: #171b24; --raised: #1c212c;
  --line: rgba(196, 206, 228, .075); --line2: rgba(196, 206, 228, .15);
  --fg: #e9e6de; --muted: #a4a9b4; --dim: #7d8391;
  /* gold = action and focus; emerald = gain; muted red = loss */
  --accent: #d6b46a; --on-accent: #17130a; --accent-2: #8fa9d8; --premium: #d6b46a; --accent-soft: rgba(214, 180, 106, .1);
  --link: #e3c98c; --up: #3fb98a; --down: #d9675e; --warn: #d9a441; --info: #7fa6e0; --predicted: #ab97e0;
  --up-soft: rgba(63, 185, 138, .12); --down-soft: rgba(217, 103, 94, .12);
  --gold: #e2c27a; --silver: #c3c8d1; --copper: #cf8f5f;
  --nav-bg: #0b0d12; --top-bg: rgba(11, 13, 18, .94);
  --radius: 8px; --radius-sm: 6px;
  --shadow: 0 1px 0 rgba(0, 0, 0, .35); --shadow-pop: 0 16px 40px rgba(0, 0, 0, .55), 0 0 0 1px var(--line2);
  --glow: 0 0 0 2px rgba(214, 180, 106, .4);
  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --display-spacing: -.015em;
  --frame-legendary: linear-gradient(var(--accent), var(--accent));
  --icon-accent: var(--accent);
}
/* scale (all themes): 4-px spacing, type ramp, breakpoints 600 / 900 / 1280 */
:root {
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --fs-xs: 11px; --fs-sm: 12.5px; --fs-md: 13.5px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 26px;
  --bar-h: 52px; --tabs-h: 40px;
  --raised: var(--panel2); --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --up-soft: color-mix(in srgb, var(--up) 14%, transparent); --down-soft: color-mix(in srgb, var(--down) 14%, transparent);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, .5), 0 0 0 1px var(--line2);
}

/* ---------- canvas ---------- */
[data-theme="forever"] body {
  background: radial-gradient(1200px 520px at 50% -220px, rgba(214, 180, 106, .055), transparent 70%), var(--bg);
}
[data-theme="forever"] ::selection { background: rgba(214, 180, 106, .3); color: #fff; }
[data-theme="forever"] main { counter-reset: none; }
[data-theme="forever"] .panel > h2::before { content: none; }
[data-theme="forever"] h1, [data-theme="forever"] h2, [data-theme="forever"] h3 { font-family: var(--font-display); letter-spacing: -.015em; }
[data-theme="forever"] .panel > h2 { font-size: 14px; font-weight: 600; letter-spacing: -.005em; padding-bottom: 9px; margin-bottom: 10px; }
[data-theme="forever"] .panel { padding: 14px 16px; }
[data-theme="forever"] tbody tr:hover td { background: rgba(214, 180, 106, .045); }
[data-theme="forever"] input, [data-theme="forever"] select, [data-theme="forever"] textarea { background: #0d1015; }
[data-theme="forever"] .kpi { background: var(--panel); }
[data-theme="forever"] .kpi .v { font-size: 20px; }
[data-theme="forever"] .brand-mark { display: none !important; }
[data-theme="forever"] .ask-fab { background: var(--raised); color: var(--fg); border: 1px solid var(--line2); box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
[data-theme="forever"] .ask-fab::before { background: var(--accent); color: var(--on-accent); content: "✦"; font-size: 11px; }
[data-theme="forever"] .ask-fab:hover { border-color: var(--accent); }
[data-theme="forever"] .up, [data-theme="forever"] .pos { color: var(--up); }
[data-theme="forever"] .down, [data-theme="forever"] .neg { color: var(--down); }
[data-theme="forever"] .data-banner { border-left-color: var(--line2); }

/* ---------- shell layout (every theme) ---------- */
:root, html.nav-collapsed { --nav-w: 0px; }
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
#bgArt { inset: 0; }
#nav, #navScrim { display: none !important; }
#topbar {
  flex: none; display: flex; align-items: center; gap: var(--sp-4); height: var(--bar-h); min-height: 0; padding: 0 var(--sp-5);
  background: var(--top-bg); border-bottom: 1px solid var(--line); position: relative; z-index: 30;
}
#topbar a.brand { display: flex; align-items: center; gap: 9px; padding: 0; border: 0; min-height: 0; text-decoration: none; color: var(--fg); flex: none; }
#topbar .brand::before {
  content: "AO"; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; flex: none;
  background: linear-gradient(160deg, #e4c886, #b99449); color: #17130a; font: 700 11.5px/1 var(--font-num); letter-spacing: -.03em;
}
[data-theme="oracle-dark"] #topbar .brand::before, [data-theme="arcane"] #topbar .brand::before { content: none; }
#topbar .brand-mark { width: 28px; height: 28px; }
#topbar .brand-text b { font: 600 14.5px/1 var(--font-ui); letter-spacing: -.01em; color: var(--fg); background: none; -webkit-text-fill-color: currentColor; white-space: nowrap; }
#sections { display: flex; align-items: stretch; height: 100%; gap: 2px; margin-left: var(--sp-2); }
#sections .sec-link {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 100%;
  font: 500 13.5px/1 var(--font-ui); color: var(--muted); text-decoration: none; white-space: nowrap; transition: color .15s;
}
#sections .sec-link:hover { color: var(--fg); text-decoration: none; }
#sections .sec-link.active { color: var(--fg); }
#sections .sec-link.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.sec-link .nav-badge { position: static; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
#topbar .top-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: nowrap; min-width: 0; }
#topbar .search-trigger {
  display: inline-flex; align-items: center; gap: 10px; height: 32px; min-width: 240px; padding: 0 8px 0 12px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line2); color: var(--dim); font: 400 13px/1 var(--font-ui); cursor: text;
}
#topbar .search-trigger span { flex: 1; text-align: left; }
#topbar .search-trigger kbd, .ask-fab kbd { font: 500 10.5px/1 var(--font-num); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--line2); color: var(--dim); background: transparent; }
.ask-fab kbd { margin-left: 8px; }
#topbar .mk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
#topbar .mk select { height: 32px; max-width: 220px; font-size: 13px; }
#topbar #dqsBadge { height: 22px; display: inline-flex; align-items: center; }
#topbar .bell { position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); }
#topbar .bell:hover { background: var(--panel2); }
#topbar .bell img { width: 18px; height: 18px; filter: grayscale(1) brightness(1.4); opacity: .75; }
#topbar .bell #alertCount { position: absolute; top: 1px; right: 0; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; font: 600 9.5px/15px var(--font-num); text-align: center; background: var(--down); color: #fff; }
#topbar .bell:not(.hot) #alertCount { display: none; }
.gear-wrap { position: relative; }
#gearBtn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); color: var(--muted); background: transparent; border: 1px solid transparent; }
#gearBtn:hover, #gearBtn[aria-expanded="true"] { color: var(--fg); background: var(--panel2); border-color: var(--line2); }
.gear-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 300px; max-height: calc(100vh - 80px); overflow-y: auto; z-index: 60;
  background: var(--raised); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px 0;
}
.gear-menu.hidden { display: none; }
.gm-opts { display: grid; gap: 8px; padding: 10px 14px 12px; border-bottom: 1px solid var(--line); }
.gm-opt { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.gm-opt select { height: 30px; width: 100%; font-size: 12.5px; }
.gm-group { padding: 6px 0; border-bottom: 1px solid var(--line); }
.gm-title { padding: 4px 14px; font: 600 10px/1.4 var(--font-num); text-transform: uppercase; letter-spacing: .09em; color: var(--dim); }
#gearMenu a { display: block; padding: 7px 14px; color: var(--fg); font-size: 13px; text-decoration: none; }
#gearMenu a:hover, .gear-menu a:focus-visible { background: var(--panel2); text-decoration: none; }
.gm-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.gm-ver { padding: 8px 14px 4px; }
#userBtn, .user-menu > summary { height: 32px; }

/* section tab strip */
#subtabs {
  flex: none; display: flex; align-items: center; gap: 2px; height: var(--tabs-h); padding: 0 var(--sp-5); overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
#subtabs::-webkit-scrollbar { display: none; }
html.no-subtabs #subtabs { display: none; }
#subtabs .sub-link {
  flex: none; display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: var(--radius-sm);
  font: 500 13px/1 var(--font-ui); color: var(--muted); text-decoration: none; white-space: nowrap;
}
#subtabs .sub-link:hover { color: var(--fg); background: var(--panel2); text-decoration: none; }
#subtabs .sub-link.active { color: var(--fg); background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line2); }
.public-ro:not(.signed-in) .sub-link.nav-private::after { content: ""; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; border: 1px solid var(--dim); }
.sub-sep { flex: none; margin: 0 6px 0 12px; padding-left: 12px; border-left: 1px solid var(--line2); font: 600 10px/1 var(--font-num); text-transform: uppercase; letter-spacing: .09em; color: var(--dim); }

/* page header + content */
main { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
#pageHead { flex: none; display: flex; align-items: center; gap: 10px; padding: 14px var(--sp-6) 4px; min-height: 0; border: 0; background: none; }
#pageHead .page-ic { display: none; }
.page-socket { display: none !important; }
#pageTitle { font: 600 20px/1.2 var(--font-display) !important; letter-spacing: -.02em; margin: 0; color: var(--fg); }
#pageSub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.data-banner { margin: 6px var(--sp-6) 0 !important; }
#view { flex: 1; overflow-y: auto; padding: 12px var(--sp-6) 56px; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 8px 12px; background: var(--accent); color: var(--on-accent); border-radius: 6px; }
.skip-link:focus { left: 8px; }

/* ---------- components (every theme) ---------- */
/* loading skeleton: the existing ".loading" placeholders become calm shimmering bars */
.loading:not(.msg) { position: relative; color: transparent !important; min-height: 44px; border-radius: var(--radius-sm); overflow: hidden;
  background: linear-gradient(90deg, var(--panel2) 0%, color-mix(in srgb, var(--panel2) 55%, var(--line2)) 50%, var(--panel2) 100%) 0 0 / 200% 100%; }
.loading:not(.msg)::after, .loading:not(.msg)::before { content: none !important; }
@media (prefers-reduced-motion: no-preference) { .loading:not(.msg) { animation: ao-skel 1.4s ease-in-out infinite; } }
@keyframes ao-skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.msg.loading { color: var(--muted); }
/* compact tables */
table { font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; }
th { position: sticky; top: 0; background: var(--panel); z-index: 1; }

/* ---------- command center (pages17.js) ---------- */
.cc-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.cc-stat { background: var(--panel); padding: 12px 14px; min-width: 0; }
.cc-stat .k { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.cc-stat .v { font: 600 19px/1.25 var(--font-num); color: var(--fg); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-stat .s { font-size: 11.5px; color: var(--dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.cc-grid > .panel { margin: 0; min-width: 0; }
.cc-6 { grid-column: span 6; } .cc-4 { grid-column: span 4; } .cc-8 { grid-column: span 8; } .cc-12 { grid-column: span 12; }
.cc-head { display: flex; align-items: baseline; gap: 10px; }
.cc-head .q { font: 600 10px/1 var(--font-num); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.cc-head .more { margin-left: auto; font-size: 12px; font-weight: 500; }
.cc-list { display: flex; flex-direction: column; }
.cc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 6px 2px; border-bottom: 1px solid var(--line); min-height: 34px; }
.cc-row:last-child { border-bottom: 0; }
.cc-row .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-row .nm small { display: block; color: var(--dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.cc-row .num { font-family: var(--font-num); font-size: 12.5px; text-align: right; white-space: nowrap; }
.cc-pill { display: inline-block; min-width: 54px; text-align: right; padding: 2px 6px; border-radius: 4px; font: 600 11.5px/1.4 var(--font-num); }
.cc-pill.up { background: var(--up-soft); color: var(--up); } .cc-pill.down { background: var(--down-soft); color: var(--down); } .cc-pill.flat { color: var(--muted); }
.cc-empty { padding: 14px 4px; color: var(--muted); font-size: 12.5px; }
.cc-empty b { display: block; color: var(--fg); font-weight: 500; margin-bottom: 2px; }
.cc-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.cc .cc-quick a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line2); border-radius: var(--radius-sm); color: var(--fg); font-size: 12.5px; text-decoration: none; background: var(--panel); }
.cc .cc-quick a:hover { border-color: var(--accent); text-decoration: none; }
.cc-quick kbd { font: 500 10px/1 var(--font-num); color: var(--dim); }
.cc-legend { font-size: 11px; color: var(--dim); margin-top: 8px; }
.home-extra > summary { cursor: pointer; list-style: none; padding: 10px 0; color: var(--muted); font-size: 13px; }
.home-extra > summary::-webkit-details-marker { display: none; }
.home-extra > summary::before { content: "▸ "; color: var(--dim); }
.home-extra[open] > summary::before { content: "▾ "; }

/* Ask Oracle suggestions */
.ask-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ask-sugg button { background: transparent !important; color: var(--fg) !important; border: 1px solid var(--line2) !important; font: 400 12px/1.3 var(--font-ui) !important; padding: 5px 9px !important; border-radius: 999px !important; text-align: left; }
.ask-sugg button:hover { border-color: var(--accent) !important; }
.ask-kind { display: inline-block; margin-top: 6px; font: 600 10px/1.4 var(--font-num); text-transform: uppercase; letter-spacing: .07em; padding: 1px 6px; border-radius: 3px; border: 1px solid currentColor; }
.ask-kind.k-verified { color: var(--up); } .ask-kind.k-estimate { color: var(--warn); } .ask-kind.k-none { color: var(--muted); }

/* palette quick actions */
.pal-row .pal-type { min-width: 70px; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  #topbar .search-trigger { min-width: 0; } #topbar .search-trigger span { display: none; }
  #topbar #dqsBadge { display: none; }
  .cc-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cc-4 { grid-column: span 6; }
}
@media (max-width: 900px) {
  :root { --bar-h: 52px; }
  #topbar { gap: var(--sp-2); padding: 0 10px; flex-wrap: nowrap !important; }
  #sections { display: none; }
  #topbar .brand-text { display: none; }
  #topbar .top-right { width: auto !important; overflow: visible !important; margin-left: auto; }
  #topbar .mk-market { display: inline-flex !important; }
  #topbar .mk-market .mk-l { display: none; }
  #topbar .mk select { max-width: 150px; }
  #subtabs { padding: 0 10px; }
  #pageHead { padding: 12px 12px 2px; }
  #pageSub { display: none; }
  #view { padding: 10px 12px calc(84px + env(safe-area-inset-bottom)); }
  .data-banner { margin: 6px 12px 0 !important; }
  .cc-grid > .panel { grid-column: 1 / -1; }
  .cc-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ask-fab { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
  .gear-menu { position: fixed; left: 10px; right: 10px; top: calc(var(--bar-h) + 6px); width: auto; }
  #tabbar { grid-template-columns: repeat(5, 1fr) !important; background: var(--nav-bg) !important; border-top: 1px solid var(--line) !important; box-shadow: none !important; }
  #tabbar a { color: var(--dim) !important; font: 500 11px/1.2 var(--font-ui) !important; letter-spacing: 0 !important; background: none !important; }
  #tabbar a.on { color: var(--fg) !important; box-shadow: inset 0 2px 0 var(--accent); }
  #tabbar a.on .si { color: var(--accent); filter: none !important; }
}
@media (max-width: 600px) {
  #topbar .mk select { max-width: 112px; }
  .cc-strip { grid-template-columns: 1fr 1fr; }
  .cc-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cc-row .num.opt { display: none; }
}

/* ---------- inner pages (2026-11-13): filter bars, chips, item verdict, crafting calculator ---------- */
.filterbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; padding: 4px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.filterbar label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.filterbar select, .filterbar input { height: 30px; font-size: 12.5px; }
.op-sum { margin: 0 0 10px; }
.op-sum:empty { display: none; }
.chips .chip, .sc-presets .chip { background: var(--panel); color: var(--muted); border: 1px solid var(--line2); border-radius: 999px; padding: 4px 11px;
  font: 500 12px/1.4 var(--font-ui); box-shadow: none; text-transform: none; letter-spacing: 0; }
.chips .chip:hover { color: var(--fg); border-color: var(--accent); filter: none; }
.chips .chip.on { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.sc-presets { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); align-items: center; }
.chips-sep { width: 1px; height: 18px; background: var(--line2); margin: 0 4px; }
.item-verdict { margin-top: 14px; }
.iv-call { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 10px; padding: 12px 14px; border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--line); border-bottom: 0; background: var(--panel); }
.iv-call b { font-size: 15px; }
.iv-call.iv-up { box-shadow: inset 3px 0 0 var(--up); } .iv-call.iv-up b { color: var(--up); }
.iv-call.iv-down { box-shadow: inset 3px 0 0 var(--down); } .iv-call.iv-down b { color: var(--down); }
.iv-call.iv-flat { box-shadow: inset 3px 0 0 var(--line2); }
.iv-why { flex-basis: 100%; color: var(--muted); font-size: 12.5px; }
.iv-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); border-radius: 0 0 var(--radius) var(--radius); margin-bottom: 0; }
.cr-calc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 0 10px; }
.cr-calc label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 900px) { .iv-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filterbar label { flex: 1 1 40%; } }
