/* App shell + shared components (Trader Home design, 2026-07-22).
   Tokens and layout adapted from the Claude Design mock in
   design export "Trader Home.dc.html"; the shell (sidebar, status
   strip, Ctrl+K palette) lives here so every tool page shares it. */
/* Light theme is the default (Dan 2026-07-22, matching OptionStrat);
   the original dark palette stays under [data-theme=dark], toggled
   from the sidebar and remembered in localStorage. */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel2: #eef1f4;
  --line: #d7dde3;
  --line2: #e6eaee;
  --line3: #c6cdd5;
  --txt: #1d2733;
  --txt2: #3c4a5a;
  --mut: #74818f;
  --acc: #1379c9;
  --acc2: #0f62a3;
  --accbg: #d8eafc;
  --pos: #178a4c;
  --neg: #cc3a2b;
  --warn: #b07f10;
  --hover: #f0f4f8;
  --cellline: rgba(0,0,0,.08);
}
:root[data-theme="dark"] {
  --bg: #12151a;
  --panel: #1a1f27;
  --panel2: #161a21;
  --line: #232a34;
  --line2: #1f2530;
  --line3: #2a313c;
  --txt: #dde3ea;
  --txt2: #b8c1cc;
  --mut: #8a94a3;
  --acc: #6ab0f3;
  --acc2: #8ec4f7;
  --accbg: #1f3a5f;
  --pos: #2ecc71;
  --neg: #e74c3c;
  --warn: #e0b040;
  --hover: #1e242e;
  --cellline: rgba(0,0,0,.25);
}
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--txt);
  font-family: "Segoe UI","Segoe UI Variable",system-ui,-apple-system,sans-serif;
  font-size: 13px;
}
a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc2); text-decoration: underline; }
::selection { background: var(--accbg); }
@keyframes livepulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line3); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- shell layout ---- */
.shell { display: flex; height: 100vh; overflow: hidden;
         font-variant-numeric: tabular-nums; }
.sidebar { width: 210px; flex-shrink: 0; background: var(--panel2);
           border-right: 1px solid var(--line); display: flex;
           flex-direction: column; overflow-y: auto; }
.sidebar .brand { padding: 14px 16px 10px; display: flex;
                  flex-direction: column; gap: 2px;
                  border-bottom: 1px solid var(--line); }
.sidebar .brandtop { display: flex; align-items: baseline; gap: 8px; }
.sidebar .brand b { font-size: 14px; font-weight: 600;
                    letter-spacing: .12em; }
/* full host on its own line under TRADER - the tailnet name is too
   long to sit beside it in a 210px rail and was being clipped */
.sidebar .brand .host { font-size: 10px; color: var(--mut);
                        letter-spacing: .02em; line-height: 1.35;
                        overflow-wrap: anywhere; }
.sidebar .navgroups { flex: 1; padding: 10px 8px; display: flex;
                      flex-direction: column; gap: 16px; }
.navgroup { display: flex; flex-direction: column; gap: 1px; }
.navgroup .grouplabel { padding: 0 10px 4px; font-size: 10px;
                        letter-spacing: .14em; color: var(--mut); }
.navitem { display: flex; align-items: center;
           justify-content: space-between; padding: 6px 10px;
           border-radius: 4px; color: var(--txt2);
           text-decoration: none; }
.navitem:hover { background: var(--panel); color: var(--txt);
                 text-decoration: none; }
.navitem.active { background: var(--accbg); color: var(--txt);
                  font-weight: 600; }
.navitem.active .dot { font-size: 10px; color: var(--acc); }
.navitem.soon { color: var(--mut); opacity: .55; cursor: default; }
.navitem.soon:hover { background: none; color: var(--mut); }
.navitem .tag { font-size: 10px; color: var(--mut);
                border: 1px solid var(--line3); border-radius: 3px;
                padding: 0 4px; }
.jumpbtn { margin: 8px; padding: 7px 10px; display: flex;
           align-items: center; justify-content: space-between;
           background: var(--panel); border: 1px solid var(--line);
           border-radius: 4px; color: var(--mut); font-size: 12px;
           font-family: inherit; cursor: pointer; }
.jumpbtn:hover { border-color: var(--line3); color: var(--txt2); }
.jumpbtn .kbd { font-size: 10px; border: 1px solid var(--line3);
                border-radius: 3px; padding: 1px 5px;
                letter-spacing: .05em; }

.maincol { flex: 1; display: flex; flex-direction: column;
           min-width: 0; overflow: hidden; }
.statusstrip { height: 38px; flex-shrink: 0; background: var(--panel2);
               border-bottom: 1px solid var(--line); display: flex;
               align-items: center; padding: 0 16px; font-size: 12px;
               white-space: nowrap; overflow: hidden; }
.statusstrip .sep { width: 1px; height: 16px; background: var(--line);
                    margin: 0 14px; flex-shrink: 0; }
.statusstrip .mkt { display: flex; align-items: center; gap: 7px; }
.statusstrip .mkt .pulse { width: 7px; height: 7px; border-radius: 50%;
                           background: var(--pos);
                           animation: livepulse 2.4s ease-in-out infinite; }
.statusstrip .mkt .pulse.closed { background: var(--mut);
                                  animation: none; }
.statusstrip .mkt b { font-weight: 600; letter-spacing: .08em; }
.statusstrip .tape { display: flex; align-items: center; gap: 14px;
                     color: var(--txt2); }
.statusstrip .tape b { font-weight: 600; color: var(--mut);
                       letter-spacing: .04em; }
.statusstrip .tape em { font-style: normal; font-size: 11px; }
.statusstrip .feeds { display: flex; align-items: center; gap: 14px;
                      color: var(--mut); }
.statusstrip .feeds .up { color: var(--pos); }
.statusstrip .feeds .down { color: var(--neg); }
.statusstrip .feeds .idle { color: var(--mut); }
.statusstrip .feeds em { color: var(--txt2); font-style: normal; }
.statusstrip .grow { flex: 1; }
.statusstrip .muted { color: var(--mut); }
.statusstrip .clock { color: var(--txt); }

.content { flex: 1; overflow: auto; padding: 16px 20px 28px; }
.content-inner { min-width: 1180px; }

/* ---- shared components ---- */
.card { background: var(--panel); border: 1px solid var(--line);
        border-radius: 5px; }
.statcard { padding: 10px 14px; }
.statcard .lbl { font-size: 10px; letter-spacing: .14em;
                 color: var(--mut); margin-bottom: 4px; }
.statcard .val { font-size: 19px; font-weight: 600; }
.statcard .sub { font-size: 11px; color: var(--mut); margin-top: 2px; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.warn { color: var(--warn); } .mut { color: var(--mut); }

.sechead { display: flex; align-items: baseline; gap: 10px;
           padding: 10px 14px; border-bottom: 1px solid var(--line); }
.sechead .title { font-size: 11px; letter-spacing: .14em;
                  font-weight: 600; color: var(--txt2); }
.sechead .grow { flex: 1; }
.sechead .count { font-size: 11px; color: var(--mut); }

.badge { display: inline-block; font-size: 10px; font-weight: 600;
         letter-spacing: .08em; padding: 2px 7px; border-radius: 3px; }
.badge.live { background: rgba(46,204,113,.14); color: var(--pos); }
.badge.watching { background: rgba(106,176,243,.14); color: var(--acc); }
.badge.waiting { background: rgba(138,148,163,.14); color: var(--mut); }
.badge.rollwin { background: rgba(224,176,64,.16); color: var(--warn); }

.btn { padding: 6px 12px; background: var(--panel);
       border: 1px solid var(--line3); border-radius: 4px;
       color: var(--txt2); font-family: inherit; font-size: 12px;
       cursor: pointer; }
.btn:hover { border-color: var(--mut); color: var(--txt); }
.btn.primary { padding: 7px 14px; background: var(--accbg);
               border-color: var(--acc); color: var(--txt);
               font-weight: 600; }
.btn.primary:hover { filter: brightness(0.96); }

/* ---- command palette ---- */
.palette-overlay { position: fixed; inset: 0;
                   background: rgba(8,10,13,.62); z-index: 100;
                   display: flex; align-items: flex-start;
                   justify-content: center; padding-top: 14vh; }
.palette { width: 560px; background: var(--panel);
           border: 1px solid var(--line3); border-radius: 7px;
           box-shadow: 0 18px 48px rgba(0,0,0,.55); overflow: hidden; }
.palette input { width: 100%; box-sizing: border-box; padding: 13px 16px;
                 background: transparent; border: none;
                 border-bottom: 1px solid var(--line); outline: none;
                 color: var(--txt); font-size: 14px;
                 font-family: inherit; }
.palette .items { max-height: 340px; overflow-y: auto; padding: 6px 0; }
.palette .item { display: flex; align-items: center; gap: 10px;
                 padding: 8px 16px; cursor: pointer; }
.palette .item.sel { background: var(--accbg); }
.palette .item .group { font-size: 10px; letter-spacing: .1em;
                        color: var(--mut); width: 64px;
                        flex-shrink: 0; }
.palette .item .name { flex: 1; font-size: 13px; }
.palette .item .hint { font-size: 11px; color: var(--mut); }
.palette .empty { padding: 14px 16px; font-size: 12px;
                  color: var(--mut); }
.palette .foot { display: flex; gap: 14px; padding: 8px 16px;
                 border-top: 1px solid var(--line); font-size: 11px;
                 color: var(--mut); }

/* ---- collapsible sidebar (2026-07-23): default expanded; collapse
   state is per-tab (sessionStorage) so a fresh session always opens
   with the nav visible ---- */
.sidebar { transition: margin-left .15s ease; }
body.navcol .sidebar { margin-left: -210px; }
.navcolbtn { margin-left: auto; background: none; border: none;
  color: var(--mut); cursor: pointer; font-size: 14px; padding: 0 2px;
  line-height: 1; }
.navcolbtn:hover { color: var(--txt); }
.navexpand { display: none; position: fixed; left: 6px; top: 5px;
  z-index: 40; background: var(--panel2); color: var(--mut);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px;
  cursor: pointer; font-size: 13px; }
.navexpand:hover { color: var(--txt); }
body.navcol .navexpand { display: block; }
body.navcol .statusstrip { padding-left: 46px; }

/* ---- beta help bubble (help.md feature doc, 2026-08-02): floating
   "?" + inline Q&A panel; only mounted when the beta cookie is
   present ---- */
.helpbubble { position: fixed; right: 18px; bottom: 18px; z-index: 60;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--acc); color: #fff; border: none; cursor: pointer;
  font-size: 19px; font-weight: 700;
  box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.helpbubble:hover { background: var(--acc2); }
.helppanel { display: none; position: fixed; right: 18px; bottom: 68px;
  z-index: 60; width: 340px; max-height: 60vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 13px; }
.helppanel.open { display: block; }
.helppanel .hp-head { display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; }
.helppanel .hp-link { margin-left: auto; color: var(--acc);
  font-size: 12px; text-decoration: none; }
.helppanel .hp-link:hover { text-decoration: underline; }
.helppanel .hp-close { background: none; border: none;
  color: var(--mut); cursor: pointer; font-size: 16px; padding: 0; }
.helppanel .hp-q { width: 100%; box-sizing: border-box; resize: none;
  background: var(--bg); color: var(--txt);
  border: 1px solid var(--line3); border-radius: 6px;
  padding: 6px 8px; font-size: 13px; font-family: inherit; }
.helppanel .hp-row { display: flex; align-items: center; gap: 10px;
  margin-top: 6px; }
.helppanel .hp-ask { background: var(--accbg); color: var(--acc);
  border: 1px solid var(--line3); border-radius: 5px;
  padding: 3px 14px; cursor: pointer; font-size: 12.5px; }
.helppanel .hp-ask:disabled { color: var(--mut); cursor: wait; }
.helppanel .hp-status { color: var(--mut); font-size: 12px; }
.helppanel .hp-a { margin-top: 8px; white-space: pre-wrap;
  line-height: 1.5; color: var(--txt2); }

/* ---- instance badge (ops.md instances, 2026-08-02): the paper unit
   shows a loud PAPER chip under the brand ---- */
.bookbadge { display: inline-block; margin: 2px 0 0 0; padding: 1px 8px;
  border-radius: 4px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .08em; background: rgba(200,150,20,.25);
  color: var(--warn); border: 1px solid var(--warn); width: fit-content; }
