/* MapleScout: the Workspace design. Sidebar app, soft grey canvas, white cards, violet accent.
   Motion: every change of page, tab or menu eases in; every press gives a small give. */
:root {
  color-scheme: light;
  --page: #f4f5f8; --panel: #ffffff; --panel-2: #f7f7fb; --line: #e6e7ee; --line-2: #d6d8e3;
  --ink: #1b1d29; --ink2: #545871; --muted: #8b8fa8;
  --accent: #6d5efc; --accent-2: #5a4aef; --accent-ink: #ffffff; --accent-soft: #efedff;
  --good: #11875f; --good-soft: #e3f7ef; --bad: #c2355a; --bad-soft: #fde8ed;
  --up: #6d5efc; --down: #f0597a; --ask: #18b37e; --vol: #dcd8ff; --depth: rgba(109, 94, 252, .12);
  --grid: #f0f1f6; --axis: #e1e3ec; --surface: #ffffff;
  --f-ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-fig: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --chart-font: "Segoe UI", system-ui, sans-serif;
  --top-h: 58px; --side-w: 264px; --radius: 12px; --row-h: 42px; --head-h: 36px;
  --ease: cubic-bezier(.2, .8, .2, 1); --ease-in: cubic-bezier(.4, 0, 1, 1);
  --fast: 140ms; --mid: 240ms; --slow: 380ms;
  --shadow: 0 1px 2px rgba(27, 29, 41, .04), 0 1px 1px rgba(27, 29, 41, .02);
  --shadow-up: 0 10px 28px -12px rgba(27, 29, 41, .22);
}
@media (prefers-reduced-motion: reduce) {
  :root { --fast: 0ms; --mid: 0ms; --slow: 0ms; }
  *, *::before, *::after { animation-duration: 0ms !important; animation-delay: 0ms !important; transition-duration: 0ms !important; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font-family: var(--f-ui); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { flex: none; }
.fig, .num { font-family: var(--f-fig); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.dim { color: var(--ink2); } .muted { color: var(--muted); }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: var(--top-h) minmax(0, 1fr); min-height: 100vh; }
.top { grid-column: 1 / -1; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 0 20px;
       background: rgba(255, 255, 255, .86); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; flex: none; width: calc(var(--side-w) - 36px); }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #8a7dff, var(--accent-2));
              color: #fff; font-weight: 800; box-shadow: 0 4px 12px -4px rgba(109, 94, 252, .7); transition: transform var(--mid) var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.brand-name { font-weight: 750; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.search { position: relative; flex: 1 1 auto; max-width: 520px; min-width: 0; }
.search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 38px; padding: 0 14px 0 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); outline: none;
                transition: border-color var(--fast), box-shadow var(--mid) var(--ease), background var(--fast); }
.search input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px;
           box-shadow: var(--shadow-up); transform-origin: top center; animation: pop var(--mid) var(--ease); max-height: 60vh; overflow-y: auto; }
.suggest a { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px;
             transition: background var(--fast); }
.suggest a:hover, .suggest a.on { background: var(--accent-soft); }
.suggest .nm { overflow-wrap: anywhere; } .suggest .pr { color: var(--ink2); font-size: 13px; }
.suggest .none { padding: 10px; color: var(--muted); }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.plan { padding: 4px 10px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 12px; text-transform: capitalize; white-space: nowrap; }
.ghost-btn, .icon-btn { background: none; border: 1px solid var(--line); border-radius: 9px; padding: 6px 12px; cursor: pointer; white-space: nowrap;
                        transition: background var(--fast), border-color var(--fast), transform var(--fast) var(--ease); }
.ghost-btn:hover, .icon-btn:hover { background: var(--panel-2); border-color: var(--line-2); }
.ghost-btn:active, .icon-btn:active, .btn:active, .chip:active { transform: scale(.96); }
.menu-btn { display: none; width: 38px; height: 38px; padding: 0; flex-direction: column; justify-content: center; gap: 4px; align-items: center; }
.menu-btn span { display: block; width: 16px; height: 2px; border-radius: 2px; background: var(--ink); transition: transform var(--mid) var(--ease), opacity var(--fast); }
.app.drawer .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.app.drawer .menu-btn span:nth-child(2) { opacity: 0; }
.app.drawer .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- sidebar ---------- */
.side { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line);
        padding: 14px 10px 24px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; z-index: 20; }
.menu { position: relative; display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.menu a { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--ink2); font-weight: 600;
          transition: color var(--fast), background var(--fast); }
.menu a svg { width: 18px; height: 18px; }
.menu a:hover { color: var(--ink); background: var(--panel-2); }
.menu a.on { color: var(--accent); background: transparent; }
.menu-ind { position: absolute; left: 0; right: 0; height: 38px; border-radius: 9px; background: var(--accent-soft); z-index: 0;
            transition: transform var(--slow) var(--ease), height var(--slow) var(--ease), opacity var(--fast); opacity: 0; }
.live-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-dot.on { background: #18b37e; box-shadow: 0 0 0 0 rgba(24, 179, 126, .5); animation: pulse 2s infinite; }
.side-sec { padding: 8px 0 4px; }
.side-sec h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; padding: 0 10px; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; }
.side-sec .count { color: var(--ink2); font-weight: 600; text-transform: none; letter-spacing: 0; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li a { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 9px;
                  transition: background var(--fast), transform var(--fast) var(--ease); }
.side-list li a:hover { background: var(--panel-2); transform: translateX(2px); }
.side-list li a.on { background: var(--accent-soft); }
.side-list li a.on .nm { color: var(--accent); font-weight: 650; }
.side-list .nm { font-size: 13px; line-height: 1.25; overflow-wrap: anywhere; }
.side-list .pr { font-size: 12px; color: var(--ink2); }
.side-list .hint { padding: 6px 10px 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.side-list .hint b { color: var(--accent); font-weight: 650; }
.ico { width: 28px; height: 28px; image-rendering: pixelated; object-fit: contain; }
.ico.none { border-radius: 7px; background: var(--line); }
.scrim { display: none; }

/* ---------- views ---------- */
.view { min-width: 0; padding: 20px 24px 40px; max-width: 1320px; width: 100%; }
.view.enter { animation: viewIn var(--slow) var(--ease); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 750; letter-spacing: -.015em; }
.page-head p { margin: 2px 0 0; color: var(--ink2); }
.grid { display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card.pad { padding: 14px 16px; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .meta { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.stack > * + * { margin-top: 16px; }
.rise { animation: rise var(--slow) var(--ease) both; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { padding: 12px 16px; transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease); }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-up); }
.tile .k { color: var(--muted); font-size: 12px; font-weight: 600; }
.tile .v { font-size: 22px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.tile .s { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 9px; padding: 7px 14px; cursor: pointer; font-weight: 650; white-space: nowrap;
       background: var(--accent); color: var(--accent-ink); transition: background var(--fast), transform var(--fast) var(--ease), box-shadow var(--mid) var(--ease); }
.btn:hover { background: var(--accent-2); box-shadow: 0 6px 16px -8px rgba(109, 94, 252, .8); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.soft:hover { background: #e4e0ff; box-shadow: none; }
.btn svg { width: 16px; height: 16px; }
.btn.tracked svg { fill: currentColor; animation: starPop var(--slow) var(--ease); }
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; position: relative; }
.seg button { position: relative; z-index: 1; background: transparent; border: 0; padding: 4px 10px; border-radius: 7px; font-weight: 650; font-size: 12px; color: var(--ink2); cursor: pointer;
              transition: color var(--fast); white-space: nowrap; }
.seg button.on { color: var(--accent); }
.seg .seg-ind { position: absolute; top: 2px; bottom: 2px; left: 0; border-radius: 7px; background: #fff; box-shadow: 0 1px 3px rgba(27, 29, 41, .12);
                transition: transform var(--mid) var(--ease), width var(--mid) var(--ease); }

/* tabs with a sliding underline */
.tabs { position: relative; display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 9px 14px; color: var(--ink2); font-weight: 650; cursor: pointer; transition: color var(--fast); white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent); }
.tabs .tab-ind { position: absolute; bottom: -1px; left: 0; height: 2px; border-radius: 2px; background: var(--accent);
                 transition: transform var(--mid) var(--ease), width var(--mid) var(--ease); }
.tab-panel { animation: fadeUp var(--mid) var(--ease); }

/* tables: ten rows, then scroll under a pinned header */
.scroll { overflow-y: auto; max-height: calc(var(--row-h) * 10 + var(--head-h)); scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.scroll.tall { max-height: calc(var(--row-h) * 18 + var(--head-h)); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.tbl th { position: sticky; top: 0; z-index: 2; background: var(--panel); text-align: left; color: var(--muted); font-size: 12px; font-weight: 650; height: var(--head-h);
          padding: 0 10px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.market-tbl th:nth-child(1) { width: 36%; }
.tbl th.sort { cursor: pointer; transition: color var(--fast); }
.tbl th.sort:hover { color: var(--ink); }
.tbl th.asc, .tbl th.desc { color: var(--accent); }
.tbl th.asc::after { content: " \2191"; } .tbl th.desc::after { content: " \2193"; }
.tbl td { height: var(--row-h); padding: 0 10px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; transition: background var(--fast); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { animation: rowIn var(--mid) var(--ease) both; }
.tbl tbody tr.link { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--panel-2); }
.tbl .r { text-align: right; }
.tbl td.fig { font-weight: 650; }
.tbl td .sub { font-size: 11px; color: var(--muted); font-weight: 500; }
.tbl tbody tr.best td:first-child { color: var(--accent); }
.itemcell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.itemcell span { min-width: 0; overflow-wrap: anywhere; line-height: 1.25; }
.qty { position: relative; }
.qty .bar { position: absolute; right: 0; top: 30%; bottom: 30%; width: var(--share, 0%); background: var(--depth); border-radius: 3px; z-index: -1;
            transition: width var(--slow) var(--ease); }
.tbl tbody tr { position: relative; z-index: 0; }
.locked { color: var(--muted); font-style: italic; }
.empty { color: var(--muted); padding: 22px 8px; text-align: center; }
.more { padding-top: 10px; text-align: center; }

/* item page */
.item-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "hero hero" "stats stats" "chart buy" "book book"; align-items: stretch; }
.hero { grid-area: hero; display: flex; align-items: center; gap: 18px; padding: 16px 20px; flex-wrap: wrap; }
.pedestal { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 14px; background: var(--panel-2); flex: none; }
.pedestal img { width: 54px; height: 54px; image-rendering: pixelated; object-fit: contain; animation: float 4s ease-in-out infinite; }
.hero-text { flex: 1 1 260px; min-width: 0; }
.hero-text .eyebrow { color: var(--muted); font-size: 12px; }
.hero-text h1 { margin: 0; font-size: 24px; font-weight: 750; letter-spacing: -.015em; overflow-wrap: anywhere; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--ink2); font-size: 13px; margin-top: 2px; }
.hero-price { text-align: right; flex: none; }
.hero-price .k { color: var(--muted); font-size: 12px; font-weight: 600; }
.hero-price .big { font-size: 32px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.delta { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); color: var(--ink2); white-space: nowrap; }
.delta.good { background: var(--good-soft); color: var(--good); } .delta.bad { background: var(--bad-soft); color: var(--bad); }
.item-grid .stats { grid-area: stats; } .item-grid .chart { grid-area: chart; display: flex; flex-direction: column; } .item-grid .buy { grid-area: buy; display: flex; flex-direction: column; }
.item-grid .book { grid-area: book; }
.item-grid.tab-book, .item-grid.tab-tape { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "book"; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--ink2); font-size: 12px; margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { width: 14px; height: 2px; vertical-align: 3px; }
.k-up { background: var(--up); } .k-down { background: var(--down); } .k-ask { background: var(--ask); } .k-vol { background: var(--vol); }
.chartbox { position: relative; width: 100%; height: 320px; flex: 1 1 auto; min-height: 280px; }
.chartbox canvas { display: block; width: 100%; height: 100%; }
.offers { display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; }
.offer { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "price who" "where where" "foot foot"; gap: 3px 12px; padding: 12px;
         border: 1px solid var(--line); border-radius: 10px; transition: border-color var(--fast), transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease);
         animation: rise var(--slow) var(--ease) both; }
.offer { cursor: pointer; transition: border-color var(--fast), background var(--mid) var(--ease), transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease); }
.offer:hover { transform: translateY(-2px); box-shadow: var(--shadow-up); border-color: var(--line-2); }
.offer.sel { border-color: var(--accent); background: var(--accent-soft); }
.offer-price { grid-area: price; font-size: 20px; font-weight: 750; transition: color var(--fast); }
.offer.sel .offer-price { color: var(--accent); }
.offer .offer-who b .chip { display: inline-block; margin: 0 0 0 6px; vertical-align: 1px; }
.offer-price .each { font-size: 11px; color: var(--muted); font-family: var(--f-ui); font-weight: 500; margin-left: 4px; }
.offer-who { grid-area: who; min-width: 0; } .offer-who b, .offer-who span { display: block; overflow-wrap: anywhere; }
.offer-who span, .offer-foot { color: var(--muted); font-size: 12px; }
.offer-where { grid-area: where; font-size: 13px; font-weight: 650; }
.offer-foot { grid-area: foot; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.offer .btn { padding: 5px 12px; font-size: 12px; }

/* feed */
.feed-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: stretch; }
.feed-list { list-style: none; margin: 0; padding: 0; }
.feed-list li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.feed-list li:last-child { border-bottom: 0; }
.feed-list li.empty { display: block; padding: 28px 12px; }
.card-head .live-dot { margin-left: 2px; }
.feed-list li.fresh { animation: slideIn var(--slow) var(--ease) both, flash 2.4s ease-out; }
.feed-list .fico { width: 40px; height: 40px; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; }
.feed-list .fico img { width: 32px; height: 32px; image-rendering: pixelated; object-fit: contain; }
.feed-list .ftxt { min-width: 0; }
.feed-list .ftxt b { font-weight: 650; overflow-wrap: anywhere; }
.feed-list .ftxt .sub { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.feed-list .fright { text-align: right; }
.feed-list .fprice { font-weight: 750; font-size: 16px; }
.feed-list .ftime { color: var(--muted); font-size: 12px; white-space: nowrap; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; margin-right: 6px; vertical-align: 1px; white-space: nowrap; }
.chip.listed { background: var(--accent-soft); color: var(--accent); }
.chip.sold { background: var(--good-soft); color: var(--good); }
.chip.low { background: #fff3d6; color: #9a6400; }
.chip.pct { background: var(--accent); color: #fff; }
.tip-btn { margin-left: 8px; padding: 1px 8px; border-radius: 6px; border: 1px solid #d9d4ff; background: var(--accent-soft); color: var(--accent);
           font-size: 11px; font-weight: 700; cursor: pointer; vertical-align: 1px; white-space: nowrap;
           transition: background var(--fast), transform var(--fast) var(--ease); }
.tip-btn:hover { background: #e4e0ff; }
.tip-btn:active { transform: scale(.94); }
#tipPop { position: fixed; z-index: 80; display: flex; gap: 8px; padding: 8px; border-radius: 12px; background: rgba(20, 22, 40, .92);
          box-shadow: 0 18px 44px -14px rgba(0, 0, 0, .55); animation: pop var(--mid) var(--ease); max-width: calc(100vw - 20px); overflow-x: auto;
          pointer-events: none; }                      /* a hover preview never steals the pointer */
#tipPop.pinned { pointer-events: auto; }               /* opened by a tap: scrollable on a phone */
#tipPop figure { margin: 0; flex: none; }
#tipPop img { display: block; width: 234px; height: 223px; image-rendering: pixelated; border-radius: 4px; }
#tipPop figcaption { color: #c9cbe0; font-size: 11px; text-align: center; margin-top: 4px; }
.chip.up { background: var(--good-soft); color: var(--good); }
.chip.gone { background: var(--panel-2); color: var(--ink2); }
.chip.warn { background: #fff3d6; color: #9a6400; cursor: help; }
.menu-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff;
              font-size: 11px; font-weight: 750; display: inline-grid; place-items: center; animation: pop var(--mid) var(--ease); }
.deal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.deal-ctl { display: flex; align-items: center; gap: 10px; }
.deal-ctl .lbl { font-weight: 650; color: var(--ink2); font-size: 13px; white-space: nowrap; }
.switch-row.tight { gap: 12px; margin: 0; padding: 0; border: 0; }
.deal-tabs { margin-left: auto; }
.deal-list li.past { opacity: .62; }
.deal-list .fprice .unit { font-size: 11px; font-weight: 600; color: var(--muted); }
.deal-list .ftxt > div:first-child { margin-bottom: 3px; }
.deal-foot { margin: 10px 0 0; }
.deal-foot:empty { display: none; }
.deal-ico svg { width: 38px; height: 38px; color: var(--accent); }
.watch-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.watch-row:last-child { border-bottom: 0; }
.watch-row a { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.x-btn { border: 0; background: none; color: var(--muted); cursor: pointer; width: 28px; height: 28px; border-radius: 7px; transition: background var(--fast), color var(--fast); }
.x-btn:hover { background: var(--bad-soft); color: var(--bad); }
.upsell { text-align: center; padding: 36px 20px; }
.upsell h2 { margin: 10px 0 6px; font-size: 20px; }
.upsell p { color: var(--ink2); max-width: 420px; margin: 0 auto 16px; }
.upsell .big-ico { font-size: 34px; }

/* loading skeleton */
.skel { border-radius: 8px; background: linear-gradient(90deg, var(--panel-2) 25%, #eceef5 37%, var(--panel-2) 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; }
.skel.line { height: 14px; margin: 10px 0; } .skel.block { height: 120px; }

/* tooltip + toast */
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: #fff; border-radius: 9px; padding: 8px 10px; font-size: 12px; max-width: 260px;
       box-shadow: var(--shadow-up); animation: pop var(--fast) var(--ease); }
.tip b { display: block; margin-bottom: 4px; } .tip .row { display: flex; justify-content: space-between; gap: 14px; } .tip .row span:first-child { color: #a9adc6; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 70; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13px;
         transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: transform var(--mid) var(--ease), opacity var(--mid) var(--ease); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
              background: radial-gradient(900px 500px at 80% -10%, #e6e2ff 0%, transparent 60%), radial-gradient(700px 400px at 0% 110%, #e1f6ee 0%, transparent 60%), var(--page); }
.login { width: 100%; max-width: 380px; padding: 28px; animation: rise var(--slow) var(--ease); }
.login .brand { width: auto; margin-bottom: 18px; }
.login h1 { margin: 0 0 4px; font-size: 22px; font-weight: 750; }
.login p { margin: 0 0 18px; color: var(--ink2); }
.login label { display: block; font-size: 12px; font-weight: 650; color: var(--ink2); margin: 12px 0 5px; }
.login input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); outline: none;
               transition: border-color var(--fast), box-shadow var(--mid) var(--ease), background var(--fast); }
.login input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.login .btn { width: 100%; justify-content: center; height: 44px; margin-top: 20px; font-size: 15px; }
.login .err { min-height: 20px; margin-top: 10px; color: var(--bad); font-size: 13px; }
.login.shake { animation: shake 360ms var(--ease); }
.login .btn:disabled { opacity: .6; cursor: default; }
.login-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; color: var(--muted); font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.code-input { text-align: center; font-family: var(--f-fig); font-size: 26px !important; font-weight: 700; letter-spacing: .5em; padding-left: .5em !important; height: 54px !important; }

/* top bar: who is signed in */
.who { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); font-size: 13px; }

/* dev dashboard */
.short { display: none; }
@media (max-width: 640px) { .long { display: none; } .short { display: inline; } }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .tiles.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.admin-grid > .card { display: flex; flex-direction: column; }
.mail-state { padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 650; }
.mail-state.ok { background: var(--good-soft); color: var(--good); }
.mail-state.warn { background: #fff3d6; color: #9a6400; }
.invite { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.invite input, .filter { flex: 1 1 220px; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); outline: none;
                        transition: border-color var(--fast), box-shadow var(--mid) var(--ease); }
.invite input:focus, .filter:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.filter { flex: 0 1 240px; margin-left: 12px; height: 32px; }
.hint { display: block; color: var(--muted); font-size: 12px; margin-top: 8px; font-weight: 400; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row b { font-weight: 650; }
.switch-row .hint { margin-top: 2px; }
.switch { flex: none; position: relative; width: 46px; height: 26px; border-radius: 999px; border: 0; background: var(--line-2); cursor: pointer; transition: background var(--mid) var(--ease); }
.switch span { position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
               transition: transform var(--mid) var(--ease); }
.switch.on { background: var(--accent); }
.switch.on span { transform: translateX(20px); }
.bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; height: 150px; align-items: end; }
.bar-day { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.bar-pair { flex: 1 1 auto; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bar-pair i { display: block; width: 40%; max-width: 14px; min-height: 2px; border-radius: 4px 4px 0 0; transition: height var(--slow) var(--ease); }
.b-su { background: var(--up); } .b-li { background: var(--ask); }
.bar-day span { color: var(--muted); font-size: 11px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.pill.allowed { background: var(--good-soft); color: var(--good); }
.pill.revoked { background: var(--bad-soft); color: var(--bad); }
.pill.admin { background: var(--accent-soft); color: var(--accent); }
.pill.pay { background: #fff3d6; color: #9a6400; }
.tier-sel { border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); padding: 3px 6px; font-size: 13px; cursor: pointer; }
.ghost-btn.sm { padding: 4px 10px; font-size: 12px; }
.acc-tbl th:nth-child(1) { width: 26%; }
@media (max-width: 1100px) { .admin-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- keyframes ---------- */
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(24, 179, 126, .55); } 70% { box-shadow: 0 0 0 8px rgba(24, 179, 126, 0); } 100% { box-shadow: 0 0 0 0 rgba(24, 179, 126, 0); } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes starPop { 0% { transform: scale(.6) rotate(-20deg); } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  .item-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "stats" "buy" "chart" "book"; }
  .feed-wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: flex; }
  .brand { width: auto; }
  .side { position: fixed; left: 0; top: var(--top-h); bottom: 0; width: min(300px, 86vw); height: auto; transform: translateX(-102%);
          transition: transform var(--slow) var(--ease); box-shadow: var(--shadow-up); }
  .app.drawer .side { transform: none; }
  .scrim { display: block; position: fixed; inset: var(--top-h) 0 0 0; background: rgba(27, 29, 41, .28); opacity: 0; pointer-events: none; z-index: 15;
           transition: opacity var(--mid) var(--ease); }
  .app.drawer .scrim { opacity: 1; pointer-events: auto; }
  .view { grid-column: 1; }
}
@media (max-width: 640px) {
  :root { --top-h: 104px; }              /* the header wraps to two lines: search drops below */
  .top { gap: 10px; padding: 8px 12px; flex-wrap: wrap; align-content: center; height: var(--top-h); }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .brand-name { font-size: 15px; }
  .who { display: none; }
  .acc-tbl th:nth-child(1) { width: 46%; }
  .view { padding: 14px 16px 32px; }
  .hide-sm { display: none; }
  .hero-price { text-align: left; flex-basis: 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tbl th, .tbl td { padding: 0 6px; }
  .market-tbl th:nth-child(1) { width: 52%; }
}
