/* Stocknet — the one stylesheet every page loads before its own.
   Tokens, type, the dark chrome (sidebar, strip, rail) and what every page shares: fields, focus,
   scrollbars, tooltips. Pages keep their own layout and components and take colors from here.

   The chrome is dark and the content is bright. Inside the three chrome regions the content tokens
   (--ink, --soft, --faint, --line, --hover, --paper) are remapped to their dark counterparts, so a
   page's sidebar rules written against the tokens turn dark without being rewritten. */

:root {
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* content: bright */
  --ink: #161615; --soft: #5e5e59; --faint: #9a9a95; --line: #e6e6e2; --rule: #d3d3ce;
  --paper: #f8f8f6; --hover: #f1f1ee; --canvas: #f3f3f0; --bubble: #f2f2ef; --surface: #ffffff;
  --mark: #d97706; --mark-soft: rgba(217, 119, 6, .12);
  --good: #1f8a4c; --bad: #c2392b; --info: #2a78d6;
  --ring: rgba(22, 22, 21, .35);
  --radius: 8px; --radius-lg: 12px;
  --shadow-pop: 0 8px 28px rgba(17, 17, 17, .12), 0 1px 3px rgba(17, 17, 17, .06);
  --shadow-dialog: 0 24px 80px rgba(17, 17, 17, .24);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 18px rgba(0, 0, 0, .05);

  /* chrome: dark */
  --chrome: #1c1c1b; --chrome-2: #262624; --chrome-3: #31312f; --chrome-line: #2d2d2b;
  --chrome-ink: #ecece8; --chrome-soft: #a6a6a0; --chrome-faint: #6c6c67;
  --aside: 248px;
}

aside, #snTop, #snRail {
  color-scheme: dark;
  --ink: var(--chrome-ink); --soft: var(--chrome-soft); --faint: var(--chrome-faint);
  --line: var(--chrome-line); --rule: var(--chrome-3); --paper: var(--chrome); --hover: var(--chrome-2);
  --surface: var(--chrome-2); --canvas: var(--chrome); --ring: rgba(236, 236, 232, .45);
  background: var(--chrome); color: var(--chrome-ink);
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14.5px/1.55 var(--sans); color: var(--ink); background: var(--chrome); display: grid; grid-template-columns: var(--aside) 1fr; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow: hidden; text-rendering: optimizeLegibility; }
html.embed body { background: #fff; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
b, strong { font-weight: 600; }
h1, h2, h3, h4 { text-wrap: balance; }
[hidden] { display: none !important; }
::selection { background: rgba(217, 119, 6, .22); }
:where(button, a, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
:where(input, textarea, select):focus-visible { outline: none; }
* { scrollbar-width: thin; scrollbar-color: #cfcfca transparent; }
aside *, #snRail, #snTop * { scrollbar-color: var(--chrome-3) transparent; }
table { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* the page is a bright sheet inside the dark frame */
main { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; background: #fff; border-radius: var(--radius-lg) 0 0 0; overflow: hidden; }
body:not(.sn-open) main { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
html.embed body { grid-template-columns: 1fr; grid-template-rows: 1fr; }
html.embed main { grid-column: 1; grid-row: 1; border-radius: 0; }

/* ------------------------------------------------------------------ the sidebar */
aside { grid-column: 1; grid-row: 1 / -1; display: flex; flex-direction: column; min-height: 0; font-size: 13.5px; }
aside .brand { display: flex; align-items: center; gap: 9px; height: 52px; padding: 0 18px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; color: var(--chrome-ink); flex: 0 0 auto; }
aside .brand img { width: 20px; height: 20px; display: block; filter: invert(1); }
aside .items { display: flex; flex-direction: column; gap: 1px; margin: 4px 10px 10px; padding-bottom: 10px; border-bottom: 1px solid var(--chrome-line); }
aside .items a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--radius); font-size: 13.5px; color: var(--chrome-soft); text-decoration: none; transition: background .12s, color .12s; }
aside .items a:hover { background: var(--chrome-2); color: var(--chrome-ink); }
aside .items a.on { background: var(--chrome-3); color: var(--chrome-ink); font-weight: 500; }
aside .items svg { width: 15px; height: 15px; flex: 0 0 auto; }
aside #new { display: flex; align-items: center; gap: 8px; margin: 0 10px 8px; padding: 6px 10px; border-radius: var(--radius); font-size: 13.5px; text-align: left; color: var(--chrome-ink); border: 1px solid var(--chrome-line); background: var(--chrome-2); transition: background .12s, border-color .12s; }
aside #new:hover { background: var(--chrome-3); border-color: #3a3a37; }
aside #new svg { width: 14px; height: 14px; }
aside .me { display: none; }
/* what a page's own sidebar rules paint with literals */
aside .row .dots:hover, aside .list .dots:hover, aside .flow .dots:hover { background: var(--chrome-3); color: var(--chrome-ink); }
aside .row input, aside .list input, aside .flow input { background: var(--chrome); color: var(--chrome-ink); border-color: var(--chrome-faint); }
aside #picker input, aside #miniFilter, aside #side textarea { background: var(--chrome-2); border-color: var(--chrome-line); color: var(--chrome-ink); }
aside #picker input:focus, aside #miniFilter:focus, aside #side textarea:focus { border-color: var(--chrome-faint); }
aside input::placeholder, aside textarea::placeholder { color: var(--chrome-faint); }
aside #side b { color: var(--chrome-ink); }
aside #side .run { background: var(--chrome-ink); color: var(--chrome); }
aside #miniList thead th { background: var(--chrome); }
aside #miniList td { border-bottom-color: var(--chrome-line); }
aside #found { background: var(--chrome-2); border-color: var(--chrome-line); color: var(--chrome-ink); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
aside #found button:hover, aside #found button.at { background: var(--chrome-3); }

/* ------------------------------------------------------------------ fields and controls in the content */
:where(main) input:not([type=checkbox]):not([type=radio]), :where(main) select, :where(main) textarea { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); transition: border-color .12s, box-shadow .12s; }
:where(main) input:not([type=checkbox]):not([type=radio]):focus, :where(main) select:focus, :where(main) textarea:focus { border-color: var(--rule); box-shadow: 0 0 0 3px rgba(22, 22, 21, .06); }
:where(main) input::placeholder, :where(main) textarea::placeholder { color: var(--faint); }
input[type=checkbox] { accent-color: var(--ink); }
:where(main) th { font-weight: 500; }
:where(main) h1 { letter-spacing: -.02em; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }

/* ------------------------------------------------------------------ the tooltip (shell.js swaps every title attribute for it) */
#snTip { position: fixed; z-index: 1000; max-width: 320px; padding: 6px 9px; border-radius: 7px; background: var(--chrome); color: var(--chrome-ink); font: 12px/1.45 var(--sans); box-shadow: 0 4px 16px rgba(0, 0, 0, .22); pointer-events: none; opacity: 0; transform: translateY(2px); transition: opacity .1s, transform .1s; overflow-wrap: anywhere; }
#snTip.show { opacity: 1; transform: none; }
