:root {
  --bg: #0c0e12; --panel: #12151b; --panel2: #181c24; --line: #222733;
  --text: #e7e9ee; --muted: #8a93a6; --accent: #f5b301; --up: #26c281; --down: #ef4f5f; --blue: #4da3ff;
  --community: #2dd4bf;   /* the Community plan's own colour (same value in css/account.css) */
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text);
  font: 13px/1.4 Inter, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
[hidden] { display: none !important; }

#app { display: grid; height: 100vh; height: 100dvh; width: 100vw; overflow: hidden; grid-template-columns: 52px minmax(0, 1fr) 300px; grid-template-rows: 48px 1fr;
  grid-template-areas: "top top top" "tools chart side"; }

/* Top bar */
#topbar { grid-area: top; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; margin-right: 6px; white-space: nowrap; }
.tb-btn { height: 32px; padding: 0 12px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.tb-btn:hover { border-color: #39404f; }
.tb-btn.on { color: #0c0e12; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.tb-btn.sym { display: flex; align-items: baseline; gap: 8px; font-weight: 700; }
.tb-btn.sym small { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.seg { display: flex; gap: 2px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { height: 26px; min-width: 34px; padding: 0 8px; border-radius: 6px; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button.on { background: #2a303d; color: var(--accent); font-weight: 600; }
.seg button:disabled { opacity: .3; cursor: default; }
.spacer { flex: 1; }
#priceBox { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#lastPrice { font-size: 16px; font-weight: 700; }
#lastChg.up, .up { color: var(--up); } #lastChg.down, .down { color: var(--down); }
.status { font-size: 11px; color: var(--muted); }
.status.live::before { content: "● "; color: var(--up); }
.status.wait::before { content: "● "; color: var(--accent); }
.status.err::before { content: "● "; color: var(--down); }

.menu { position: relative; }
.pop { position: absolute; top: 38px; left: 0; z-index: 30; min-width: 210px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.pop h5 { margin: 6px 8px 4px; font-size: 10px; letter-spacing: .8px; color: var(--muted); text-transform: uppercase; }
.pop label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.pop label:hover { background: var(--panel2); }
.pop input { padding: 0; accent-color: var(--accent); }

.pop.right { left: auto; right: 0; min-width: 250px; padding: 12px; }
.tb-btn.plan { font-weight: 700; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; }
.tb-btn.plan.paid { color: var(--accent); border-color: rgba(245,179,1,.5); }
.plan-line { margin: 0 0 10px; color: #c3c9d4; }
.preview { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.preview small { display: block; color: var(--muted); margin-bottom: 6px; }
.pro-tag { font-size: 9px; font-weight: 800; letter-spacing: .8px; color: var(--accent); border: 1px solid rgba(245,179,1,.5); border-radius: 4px; padding: 1px 5px; }
.locked-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; border-radius: 8px; background: rgba(245,179,1,.08); color: #c3c9d4; }
ul.benefits { margin: 0; padding: 0; list-style: none; }
ul.benefits li { padding: 6px 0 6px 22px; position: relative; }
ul.benefits li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.price { font-size: 18px; font-weight: 800; }
.primary.wide { width: 100%; height: 40px; }
.code-row { display: flex; gap: 8px; } .code-row input { flex: 1; min-width: 0; }
.small-note { margin: 0; min-height: 18px; font-size: 12px; }

/* Tools */
#tools { grid-area: tools; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; position: relative; z-index: 20; }
.tool { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: #b8bfcc; position: relative; }
.tool:hover { background: var(--panel2); color: var(--text); }
.tool.on { background: rgba(245,179,1,.14); color: var(--accent); }
.tool svg { width: 20px; height: 20px; }
.tool.armed { background: rgba(239,79,95,.2); color: var(--down); }
.tools-sep { width: 26px; height: 1px; background: var(--line); margin: 4px 0; }
.fly { position: absolute; left: 50px; z-index: 40; min-width: 250px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.fly h5 { margin: 4px 8px 6px; font-size: 10px; letter-spacing: .8px; color: var(--muted); text-transform: uppercase; }
.fly button.item { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 8px; border-radius: 6px; text-align: left; }
.fly button.item:hover { background: var(--panel2); }
.fly kbd { font: 11px ui-monospace, Menlo, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.fly .deg { display: flex; align-items: center; gap: 8px; padding: 8px; border-top: 1px solid var(--line); margin-top: 6px; color: var(--muted); }
.fly .deg select { flex: 1; padding: 5px 8px; }

/* Chart */
#chartWrap { grid-area: chart; position: relative; min-width: 0; min-height: 0; background: var(--bg); }
#chart { position: absolute; inset: 0; }
#watermark { position: absolute; left: 0; right: 64px; top: 30%; text-align: center; font-size: clamp(20px, 4.4vw, 58px); font-weight: 800; letter-spacing: 3px; text-transform: uppercase; line-height: 1.1; color: rgba(255,255,255,.055); pointer-events: none; user-select: none; }
#skoolLink { position: absolute; right: 68px; bottom: 34px; z-index: 6; display: block; padding: 4px; line-height: 0; cursor: pointer; opacity: .92; transition: opacity .12s ease, transform .12s ease; }
#skoolLink img { height: 22px; width: auto; display: block; filter: drop-shadow(0 0 1px rgba(255,255,255,.55)) drop-shadow(0 0 5px rgba(12,14,18,.9)); }
#skoolLink:hover { opacity: 1; transform: scale(1.06); }
#hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 16px); padding: 5px 6px 5px 12px; border-radius: 999px; background: rgba(18,21,27,.95); border: 1px solid var(--accent); color: var(--text); font-size: 12px; white-space: nowrap; }
#hint span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#hint button { height: 26px; padding: 0 12px; border-radius: 999px; font-weight: 700; font-size: 12px; flex: none; }
#hint .done { background: var(--accent); color: #0c0e12; } #hint .cancel { background: var(--panel2); border: 1px solid var(--line); }
#overlayMsg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); background: rgba(12,14,18,.7); z-index: 9; padding: 20px; }

/* Side panel */
#side { grid-area: side; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#tabs { display: flex; border-bottom: 1px solid var(--line); }
#tabs button { flex: 1; height: 40px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; }
#tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tab { flex: 1; overflow: auto; padding: 14px; }
.tab h4 { margin: 16px 0 6px; font-size: 10px; letter-spacing: .8px; color: var(--muted); text-transform: uppercase; }
.muted { color: var(--muted); }
.wi-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wi-head b { font-size: 15px; }
.tag { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); }
.tag.up { color: var(--up); border-color: rgba(38,194,129,.4); } .tag.down { color: var(--down); border-color: rgba(239,79,95,.4); }
.verdict { margin-top: 12px; padding: 9px 10px; border-radius: 8px; font-weight: 600; }
.verdict.ok { background: rgba(38,194,129,.12); color: var(--up); }
.verdict.bad { background: rgba(239,79,95,.12); color: var(--down); }
.verdict.wip { background: rgba(245,179,1,.10); color: var(--accent); }
ul.rules { list-style: none; margin: 0; padding: 0; }
ul.rules li { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(34,39,51,.6); }
ul.rules li i { font-style: normal; width: 14px; flex: none; text-align: center; font-weight: 700; }
ul.rules li.pass i { color: var(--up); } ul.rules li.fail { color: var(--down); } ul.rules li.pending { color: var(--muted); }
table.kv { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.kv td { padding: 5px 0; border-bottom: 1px solid rgba(34,39,51,.6); }
table.kv td:last-child { text-align: right; font-weight: 600; }
.field { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); }
.field select { flex: 1; padding: 6px 8px; }
.btn { height: 32px; padding: 0 12px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); }
.btn:hover { border-color: #39404f; }
.primary { height: 34px; padding: 0 16px; border-radius: 8px; background: var(--accent); color: #0c0e12; font-weight: 700; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.row-gap { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.guide p { margin: 0 0 10px; color: #c3c9d4; }
.guide kbd { font: 11px ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--text); }

.obj, .wrow { display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 8px; }
.obj:hover, .wrow:hover { background: var(--panel2); }
.obj.sel { background: rgba(245,179,1,.10); }
.obj .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mini { width: 26px; height: 26px; border-radius: 6px; color: var(--muted); display: grid; place-items: center; }
.mini:hover { background: #2a303d; color: var(--text); }
.mini.off { opacity: .4; }
.sync-note { margin: 12px 8px 0; font-size: 11.5px; line-height: 1.5; }
.sync-note a { color: var(--accent); } p.muted + .sync-note { margin-left: 0; }
.wrow { cursor: pointer; font-variant-numeric: tabular-nums; }
.wrow .name { flex: 1; font-weight: 600; } .wrow .name small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.wrow .px { width: 86px; text-align: right; } .wrow .ch { width: 62px; text-align: right; }

/* Modals */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6); display: grid; place-items: start center; padding-top: 9vh; }
.sheet { width: min(560px, 92vw); max-height: 78vh; display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.sheet.small { width: min(380px, 92vw); }
.modal.mid { place-items: center; padding-top: 0; }
.welcome { display: flex; flex-direction: column; gap: 10px; } .welcome p { margin: 0; line-height: 1.5; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.x { width: 28px; height: 28px; border-radius: 6px; color: var(--muted); } .x:hover { background: var(--panel2); color: var(--text); }
.list { overflow: auto; min-height: 120px; }
.srow { display: flex; align-items: center; gap: 8px; padding: 9px 8px; border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums; }
.srow:hover { background: var(--panel2); }
.srow .name { flex: 1; font-weight: 700; } .srow .name small { color: var(--muted); font-weight: 500; }
.srow .px { width: 110px; text-align: right; } .srow .ch { width: 70px; text-align: right; }
.star { width: 26px; height: 26px; border-radius: 6px; color: var(--muted); } .star.on { color: var(--accent); } .star:hover { background: #2a303d; }

#tfs { flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
#tfs::-webkit-scrollbar { display: none; }
#tfs button { flex: none; }
#tfs button:disabled { display: none; }   /* timeframes this exchange does not offer */
#priceBox, .brand, .menu, #symbolBtn { flex: none; }

@media (max-width: 1240px) {
  .status { font-size: 0; } .status::before { font-size: 11px; }
  .tb-btn.share span { display: none; } .tb-btn.share { padding: 0 9px; }
}
@media (max-width: 1060px) { #logBtn { display: none; } .brand span { display: none; } }
/* Narrow windows: the side panel moves under the chart instead of disappearing. */
@media (max-width: 900px) {
  #app { grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr) 230px;
    grid-template-areas: "top top" "tools chart" "side side"; }
  #side { border-left: 0; border-top: 1px solid var(--line); }
  #lastChg { display: none; }
  .tb-btn.sym small { display: none; }
}
@media (max-width: 620px) { #indBtn { padding: 0 8px; } #topbar { gap: 6px; padding: 0 8px; } }

/* Trade setup card in Wave info */
.setup { padding: 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--up); }
.setup.short { border-left-color: var(--down); }
.setup-head { display: flex; align-items: center; gap: 8px; }
.setup-head .side { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; padding: 3px 9px; border-radius: 6px; background: var(--up); color: #0c0e12; }
.setup.short .setup-head .side { background: var(--down); color: #fff; }
.setup-head b { font-size: 14px; }
.setup-head .rr { margin-left: auto; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.setup-head .rr.great, .setup-head .rr.good { color: var(--up); } .setup-head .rr.thin { color: var(--accent); } .setup-head .rr.poor { color: var(--down); }
.setup .verdict { margin: 10px 0 6px; }
.setup table.kv tr.main td { color: #fff; font-weight: 700; }
.setup .small-note { margin: 8px 0 0; font-size: 11.5px; }
.setup-none { margin: 0; }

.src-note { margin: 0 0 6px; font-size: 11.5px; }

/* Where to trade, share menu, shared-chart banner */
.tb-btn.icon { width: 32px; padding: 0; display: grid; place-items: center; color: var(--accent); }
.tb-btn.icon.pulse { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,179,1,.25); }
.tb-btn.share { display: flex; align-items: center; gap: 6px; }
.pop-title { margin: 4px 8px 6px; font-size: 10px; letter-spacing: .8px; color: var(--muted); text-transform: uppercase; }
.pop a.venue { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.pop a.venue:hover { background: var(--panel2); } .pop a.venue span { color: var(--accent); font-size: 12px; white-space: nowrap; }
.pop .small-note { margin: 6px 8px 4px; max-width: 230px; font-size: 11px; min-height: 0; }
.pop.tip { width: 270px; padding: 12px; border-color: var(--accent); z-index: 40; }
.pop.tip::before { content: ""; position: absolute; top: -6px; left: 11px; width: 10px; height: 10px; background: var(--panel); border-left: 1px solid var(--accent); border-top: 1px solid var(--accent); transform: rotate(45deg); }
.pop.tip p { margin: 6px 0 10px; color: #c3c9d4; }
#sharePop { min-width: 260px; }
.menu-row { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; }
.menu-row:hover { background: var(--panel2); } .menu-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; white-space: normal; }
.link-box { width: 100%; margin-top: 6px; padding: 7px 8px !important; font-size: 11.5px; }
#toast { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 12; padding: 8px 14px; border-radius: 999px; background: var(--accent); color: #0c0e12; font-weight: 700; font-size: 12px; pointer-events: none; }
#sharedBar { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 90px); padding: 6px 6px 6px 12px; border-radius: 10px; background: rgba(18,21,27,.94); border: 1px solid var(--accent); font-size: 12px; }
#sharedBar .primary, #sharedBar .btn { height: 28px; padding: 0 10px; white-space: nowrap; }
#sharedBar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.plans { display: flex; flex-direction: column; gap: 8px; }
.plans .plan { height: auto; min-height: 44px; padding: 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; }
.plans .plan small { font-weight: 800; font-size: 10px; letter-spacing: .6px; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: rgba(12,14,18,.18); }

.tb-break { display: none; }
/* Phones: two-row top bar, menus as full-width sheets, bigger touch targets */
@media (max-width: 620px) {
  #app { grid-template-rows: auto minmax(0, 1fr) 200px; }
  #topbar { flex-wrap: wrap; height: auto; padding: 7px 8px; gap: 6px; }
  .brand { display: none; }
  .tb-break { display: block; flex-basis: 100%; height: 0; order: 9; }
  #tfs { order: 10; flex: 1 1 0; min-width: 0; }
  #indMenu { order: 11; } #shareMenu { order: 12; } #logBtn { display: none; }
  .tb-btn { height: 34px; } .seg button { height: 28px; min-width: 38px; }
  .tb-btn.sym { max-width: 132px; overflow: hidden; } .tb-btn.sym span { overflow: hidden; text-overflow: ellipsis; }
  .tb-btn.plan { font-size: 10px; padding: 0 8px; letter-spacing: .3px; }
  .tb-btn.signin { width: 34px; padding: 0; justify-content: center; } .tb-btn.signin span { display: none; }
  #priceBox { font-size: 14px; gap: 5px; } .status { margin-left: 0; }
  .menu { position: static; }
  .pop, .pop.right { position: fixed; left: 8px; right: 8px; top: 92px; min-width: 0; width: auto; max-height: 70dvh; overflow: auto; }
  .pop.tip { width: auto; } .pop.tip::before { display: none; }
  .pop .small-note { max-width: none; }
  #watermark { font-size: 15px; letter-spacing: 1.5px; white-space: nowrap; right: 52px; }
  #skoolLink img { height: 18px; }
  #hint { top: 8px; }
  .fly { min-width: 0; width: min(270px, calc(100vw - 62px)); }
  .tab { padding: 12px; }
  input, select { font-size: 16px; }   /* stops iPhones zooming the page when a box is tapped */
  .modal { padding-top: 5vh; } .sheet { max-height: 88dvh; overflow: auto; }
  #sharedBar { max-width: calc(100% - 12px); top: 6px; }
}

.legal-links { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; }
.legal-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; } .legal-links a:hover { color: var(--text); }
.pop .legal-links { margin: 6px 8px 4px; } .setup .legal-links { margin-top: 4px; }

/* Accounts: the Sign in button, plan badge colours when signed in (the same three as css/account.css:
   Free grey, Pro gold, Community teal), and the account rows in the plan pop-up. */
.tb-btn.signin { flex: none; display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; text-decoration: none; }
.tb-btn.signin svg { flex: none; color: var(--accent); }
.tb-btn.plan.p-free { background: #2a303d; border-color: #4a5263; color: #d5dae3; }
.tb-btn.plan.p-pro { background: var(--accent); border-color: var(--accent); color: #0c0e12; }
.tb-btn.plan.p-community { background: var(--community); border-color: var(--community); color: #0c0e12; }
.plan-email { margin: 0 0 6px; max-width: 260px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-rows { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
a.menu-row { color: var(--text); text-decoration: none; }
a.btn.wide { display: flex; align-items: center; justify-content: center; width: 100%; height: 36px; margin-top: 8px; color: var(--text); font-weight: 600; text-decoration: none; }
@media (max-width: 1340px) { .tb-btn.signin { width: 32px; padding: 0; justify-content: center; } .tb-btn.signin span { display: none; } }
@media (max-width: 620px) { .tb-btn.signin { width: 34px; } .plan-email { max-width: none; } }
@media (max-width: 620px) { .srow .name { min-width: 0; } .srow .name small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .srow .px { width: 96px; } }

/* Install on the home screen */
.install-row { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.install-on { display: block; margin-top: 4px; font-size: 13px; }
ol.install-steps { margin: 0; padding-left: 20px; line-height: 1.55; } ol.install-steps li { padding: 2px 0; }
