* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f6f3f1;
  color: #19213a;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color-scheme: light;
  --menu-height: 28px;
  --chrome-text: #303030;
  --chrome-border: #a8a8a8;
  --chrome-selection: #386cbd;
}

/* Match the dashboard's compact light desktop menu. */
.desktop-menubar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  column-gap: 12px;
  min-height: var(--menu-height);
  padding: 0 14px;
  border-bottom: 1px solid var(--chrome-border);
  background: linear-gradient(#f8f8f8, #e5e5e5);
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%);
  color: var(--chrome-text);
  font-size: 13px;
}

.desktop-menu-navigation,
.desktop-menu {
  position: relative;
}

.desktop-menu-navigation { display: flex; flex-shrink: 0; align-items: flex-start; white-space: nowrap; }

.blog-disclaimer {
  position: relative;
  margin-left: auto;
  min-width: 0;
  color: #555;
  white-space: nowrap;
  cursor: help;
}
.blog-disclaimer:focus-visible {
  outline: 2px solid var(--chrome-selection);
  outline-offset: 2px;
}
.blog-disclaimer-tooltip {
  position: absolute;
  z-index: 1;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid var(--chrome-border);
  border-radius: 6px;
  background: #fafafa;
  color: var(--chrome-text);
  box-shadow: 0 8px 24px rgb(0 0 0 / 22%);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  cursor: auto;
}
.blog-disclaimer-tooltip[hidden] { display: none; }
.blog-disclaimer-tooltip::before {
  content: "";
  position: absolute;
  inset: -8px 0 auto;
  height: 8px;
}

.desktop-app-name,
.desktop-menu-label {
  display: flex;
  align-items: center;
  min-height: 27px;
  padding: 0 13px 0 4px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.desktop-menu-label { padding: 0 12px; font-weight: 400; }
:is(.desktop-app-name, .desktop-menu-label)::-webkit-details-marker { display: none; }
:is(.desktop-app-name, .desktop-menu-label)::marker { content: ""; }
:is(.desktop-app-name, .desktop-menu-label):hover { background: #dedede; }
.desktop-menu[open] > summary { background: var(--chrome-selection); color: #fff; }

.desktop-menu-panel {
  position: absolute;
  top: 100%;
  left: 0;
  width: 230px;
  max-width: calc(100vw - 28px);
  max-height: calc(100svh - 52px);
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--chrome-border);
  border-radius: 0 0 6px 6px;
  background: #fafafa;
  box-shadow: 0 8px 24px rgb(0 0 0 / 22%);
}

.desktop-menu-panel :is(button, a) {
  display: block;
  width: 100%;
  padding: 7px 12px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.desktop-menu-panel :is(button, a):is(:hover, :focus-visible) {
  background: var(--chrome-selection);
  color: #fff;
}

:is(summary, button, a, input, textarea):focus-visible {
  outline: 2px solid var(--chrome-selection);
  outline-offset: 2px;
}

.background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.background::before,
.background::after {
  content: "";
  position: absolute;
  inset: -25%;
}

.background::before {
  background:
    radial-gradient(ellipse at 25% 30%, #d2c5ef 0%, transparent 55%),
    radial-gradient(ellipse at 75% 65%, #f3cebb 0%, transparent 55%),
    radial-gradient(ellipse at 55% 85%, #c5dcf3 0%, transparent 60%);
  animation: gradient-drift 24s ease-in-out infinite alternate;
}

.background::after {
  background:
    radial-gradient(ellipse at 80% 20%, #cddfeb 0%, transparent 50%),
    radial-gradient(ellipse at 20% 75%, #efdae6 0%, transparent 50%);
  opacity: 0.65;
  animation: gradient-drift 32s ease-in-out infinite alternate-reverse;
}

main {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(4rem + var(--menu-height)) 1.5rem 4rem;
}

h1 {
  margin: 0;
  max-width: 100%;
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.1;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.blog-content {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem);
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 16px;
  background: rgb(250 249 248 / 94%);
  box-shadow: 0 12px 40px rgb(25 33 58 / 6%);
}

.post-list { margin: 2rem 0 0; padding: 0; list-style: none; }
.post-list li { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 0.5rem 1.5rem; padding: 1rem 0; border-top: 1px solid #dfdce2; align-items: baseline; }
.post-list time, .post-header time { color: #626272; font-size: 0.875rem; }
.post-list a { font-size: 1.125rem; font-weight: 650; overflow-wrap: anywhere; text-decoration: none; }
.blog-content a { color: #284f89; text-underline-offset: 0.2em; }
.blog-content a:hover { text-decoration: underline; }
.back-link { display: inline-block; margin-bottom: 2.5rem; font-size: 0.875rem; text-decoration: none; }
.post-header h1 { margin-top: 0.75rem; }
.post-content { margin-top: 2rem; font-size: 1.0625rem; line-height: 1.75; overflow-wrap: anywhere; }
.post-content > :first-child { margin-top: 0; }
.post-content > :last-child { margin-bottom: 0; }
.post-content h2, .post-content h3, .post-content h4 { line-height: 1.3; margin-top: 2rem; }
.post-content img { display: block; max-width: 100%; height: auto; border-radius: 8px; }
.post-content pre { padding: 1rem; overflow-x: auto; background: #eeedf1; border-radius: 6px; font-size: 0.875rem; }
.post-content code { font-family: ui-monospace, monospace; }
.post-content :not(pre) > code { padding: 0.15em 0.3em; background: #eeedf1; border-radius: 3px; }
.post-content blockquote { margin-left: 0; padding-left: 1.25rem; border-left: 3px solid #c5bfd2; color: #55566a; }
.post-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.post-content th, .post-content td { border: 1px solid #dfdce2; padding: 0.4rem 0.75rem; }
.empty-posts { color: #626272; }

/* The index is already a full workspace before JavaScript adds window controls. */
.blog-window {
  position: fixed;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--chrome-border);
  border-radius: 9px;
  background: rgb(250 249 248 / 96%);
  box-shadow: 0 5px 18px rgb(0 0 0 / 18%);
  pointer-events: auto;
}

.blog-index-window { inset: calc(var(--menu-height) + 8px) 8px 8px; }
.blog-desktop-ready { overflow: hidden; }
.blog-desktop-ready main { min-height: 0; padding: 0; }
.blog-desktop { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.blog-desktop .blog-index-window { right: auto; bottom: auto; }
.blog-window[hidden] { display: none; }
.blog-window.is-front { box-shadow: 0 12px 40px rgb(0 0 0 / 28%); }
.blog-window-titlebar {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 1px 8px;
  border-bottom: 1px solid var(--chrome-border);
  background: linear-gradient(#fafafa, #dedede);
  color: var(--chrome-text);
  user-select: none;
}
.blog-desktop .blog-window-titlebar { cursor: move; touch-action: none; }
.blog-window.is-expanded .blog-window-titlebar { cursor: default; }
.blog-window-title {
  flex: 1;
  min-width: 0;
  margin: 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}
.blog-window-lights { display: flex; flex: 0 0 auto; gap: 3px; }
.blog-window-light {
  position: relative;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}
.blog-window-light::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgb(0 0 0 / 12%);
  border-radius: 50%;
  box-sizing: border-box;
}
.blog-window-light.close::before { background: #ff5f57; }
.blog-window-light.minimize::before { background: #febc2e; }
.blog-window-light.expand::before { background: #28c840; }
.blog-window-light::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #242424;
  font: bold 13px/1 system-ui;
  opacity: 0;
}
.blog-window-light.close::after { content: '×'; }
.blog-window-light.minimize::after { content: '−'; }
.blog-window-light.expand::after { content: '↗'; }
.is-expanded .blog-window-light.expand::after { content: '↙'; }
.blog-window-lights:hover .blog-window-light::after,
.blog-window-light:focus-visible::after { opacity: 1; }
.blog-window-light:disabled { cursor: default; opacity: 0.4; }
.blog-window-permalink { flex: 0 0 auto; padding: 4px 8px; color: #444; text-decoration: none; }
.blog-window-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  container-type: inline-size;
}
.blog-window .blog-content { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.blog-back-button { padding: 0; border: 0; background: none; color: #284f89; font-family: inherit; cursor: pointer; }
.blog-back-button:hover { text-decoration: underline; }
.blog-window-notice { padding: 2rem; font-size: 0.9375rem; }
.blog-window-notice a { color: #284f89; }
.blog-retry { margin-right: 1rem; padding: 6px 14px; border: 1px solid var(--chrome-border); border-radius: 4px; background: #f6f6f6; color: var(--chrome-text); font: inherit; cursor: pointer; }
.blog-window-edge { position: absolute; z-index: 1; touch-action: none; }
.blog-window .edge-n { top: 0; left: 9px; right: 9px; height: 5px; cursor: n-resize; }
.blog-window .edge-s { bottom: 0; left: 9px; right: 9px; height: 5px; cursor: s-resize; }
.blog-window .edge-e { right: 0; top: 9px; bottom: 9px; width: 5px; cursor: e-resize; }
.blog-window .edge-w { left: 0; top: 9px; bottom: 9px; width: 5px; cursor: w-resize; }
.blog-window :is(.edge-ne, .edge-nw, .edge-se, .edge-sw) { width: 12px; height: 12px; }
.blog-window .edge-ne { top: 0; right: 0; cursor: ne-resize; }
.blog-window .edge-nw { top: 0; left: 0; cursor: nw-resize; }
.blog-window .edge-se { bottom: 0; right: 0; cursor: se-resize; border-right: 3px double #888; border-bottom: 3px double #888; }
.blog-window .edge-sw { bottom: 0; left: 0; cursor: sw-resize; }
.blog-window.is-expanded .blog-window-edge { display: none; }
.blog-window-gesturing { user-select: none; }
:is(.blog-window-titlebar, .blog-window-edge):focus-visible { outline: 2px solid var(--chrome-selection); outline-offset: -2px; }

@container (max-width: 580px) {
  .post-list li { grid-template-columns: minmax(0, 1fr); }
  .blog-content { padding: 1.5rem; }
}

.local-drafts { margin-top: 2.5rem; }
.local-drafts[hidden] { display: none; }
.local-drafts h2 { margin-bottom: 0.5rem; font-size: 1.25rem; }
.draft-panel { max-width: 900px; margin: 0 auto; padding: clamp(1rem, 4vw, 2rem); }
.draft-preview-tools { max-width: 900px; margin: 0 auto; padding: 0.5rem clamp(1rem, 4vw, 2rem); border-bottom: 1px solid #dfdce2; }
.draft-panel h2 { margin-top: 0; }
.draft-help { color: #626272; font-size: 0.875rem; line-height: 1.5; }
.draft-error { color: #9b2838; font-size: 0.875rem; line-height: 1.5; }
.draft-field { display: flex; flex-direction: column; gap: 0.4rem; margin: 1rem 0; font-size: 0.875rem; font-weight: 600; }
.draft-field input, .draft-panel textarea {
  width: 100%; min-width: 0; padding: 0.7rem; border: 1px solid #b6b4bf;
  border-radius: 5px; background: #fff; color: #19213a; font: inherit; font-size: 1rem;
}
.draft-panel textarea { resize: vertical; min-height: 180px; font: 0.9375rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.draft-export textarea { min-height: 260px; background: #f7f7fa; }
.draft-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.draft-button {
  padding: 0.45rem 0.7rem; border: 1px solid #b6b4bf; border-radius: 5px;
  background: linear-gradient(#fff, #ededf1); color: #283b5d; font: inherit; font-size: 0.875rem; cursor: pointer;
}
.draft-button:hover { background: #e5eefc; }
.draft-button:disabled { opacity: 0.5; cursor: default; }
.draft-title { border: 0; padding: 0; background: transparent; font-size: 1.125rem; font-weight: 650; text-align: left; overflow-wrap: anywhere; }
.draft-title:hover { background: transparent; text-decoration: underline; }
.draft-badge { display: inline-block; margin: 0.25rem 0 0.25rem 0.65rem; padding: 0.2rem 0.45rem; border-radius: 4px; background: #e9e2f4; color: #5c407e; font-size: 0.75rem; }
.draft-save-status { min-height: 1.5em; font-size: 0.875rem; }
.draft-filename { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.draft-confirm { color: #9b2838; margin-right: 0.5rem; }

.position-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px 16px; margin: 1.5rem 0; padding: 14px 16px; border: 1px solid #c9cbd2; border-radius: 7px; background: #fff; color: #303642; font-size: 13px; line-height: 1.4; }
.position-card-main { min-width: 0; }
.position-card, .position-example { overflow-anchor: none; }
.position-card-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.position-card-symbol { font-size: 14px; font-weight: 750; }
.position-open { margin-left: auto; padding: 3px 6px; border: 1px solid #a8a8a8; border-radius: 4px; background: linear-gradient(#fff, #f2f2f2); color: #303030; font: inherit; font-size: 11px; cursor: pointer; }
.position-open:hover { background: #e5eefc; }
.position-open:focus-visible { outline: 2px solid #1679ef; outline-offset: 2px; }
.position-card .position-card-proposal { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 10px 0; }
.position-card-proposal > span { color: #666c79; font-size: 11px; }
.position-card-proposal strong { font-size: 20px; font-weight: 750; line-height: 1.2; }
.position-action-sell { color: #a82e34; }
.position-action-buy { color: #137c3c; }
.position-card-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr)); gap: 10px 20px; margin: 0; font-variant-numeric: tabular-nums; }
.position-card-metrics dt { font-size: 11px; color: #666c79; }
.position-card-metrics dd { margin: 2px 0 0; font-weight: 650; }
.position-card .position-card-date { flex: 1 1 240px; min-width: 0; margin: 0; color: #666c79; font-size: 11px; }
.position-parameters-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 8px; }
.position-parameters-heading > h3 { margin: 0; font-size: 14px; }
.position-parameter-button { padding: 3px 7px; border: 1px solid #a8a8a8; border-radius: 4px; background: linear-gradient(#fff, #f2f2f2); color: #303030; font: inherit; font-size: 11px; cursor: pointer; }
.position-parameter-button:disabled { opacity: 0.6; cursor: wait; }
.position-card-parameters input[type="range"] { display: block; width: 100%; margin: 8px 0 4px; accent-color: #4267b0; }
.position-card-parameters select { max-width: 100%; margin-top: 6px; padding: 4px 6px; border: 1px solid #c5c0d2; border-radius: 4px; background: #fff; color: inherit; font: inherit; }
.position-parameter-range { display: block; color: #666c79; font-size: 11px; font-weight: 400; }
.position-card .position-edit-status { margin: 8px 0 0; color: #626272; font-size: 12px; }
.position-card-parameters table { display: table; width: 100%; table-layout: fixed; border-collapse: collapse; font-size: inherit; font-variant-numeric: tabular-nums; }
.position-card-parameters th { width: 60%; text-align: left; background: #f6f5f8; font-size: 11px; font-weight: 600; }
.position-card-parameters :is(th, td) { padding: 0.5rem; border: 1px solid #e5e2eb; overflow-wrap: anywhere; }
.position-card-parameters td { font-weight: 650; }
.position-trading-rules { margin-top: 12px; }
.position-trading-rules > summary { cursor: pointer; font-size: 13px; font-weight: 650; }
.position-rule-help { display: block; margin-top: 5px; color: #666c79; font-size: 11px; font-weight: 400; line-height: 1.4; }
.position-trading-rules input[type="number"] { box-sizing: border-box; width: 100%; min-width: 0; margin-top: 6px; padding: 4px 6px; border: 1px solid #c5c0d2; border-radius: 4px; background: #fff; color: inherit; font: inherit; }
.position-trading-rules input[type="checkbox"] { width: 16px; height: 16px; margin: 6px 0 0; accent-color: #4267b0; }
.position-trading-rules :is(input, select):disabled { opacity: 0.55; cursor: not-allowed; }
.position-card-fallback { grid-column: 1 / -1; min-width: 0; }
.position-card-fallback > summary { cursor: pointer; color: #284f89; }
.position-card [hidden] { display: none; }
.position-inline-preview { min-width: 0; padding-top: 12px; border-top: 1px solid #e5e2eb; }
.position-inline-preview > h3 { margin: 0; font-size: 14px; }
.position-inline-preview > p { margin: 8px 0; font-size: 12px; line-height: 1.5; }
.position-inline-preview .position-preview-controls { margin: 12px 0; }
.position-inline-preview .position-table-wrap { max-height: 360px; overflow: auto; overscroll-behavior: contain; margin-bottom: 0; }
.position-inline-preview thead th { position: sticky; top: 0; z-index: 1; }
.position-inline-preview .position-table-wrap:focus-visible { outline: 2px solid #1679ef; outline-offset: -2px; }

.position-example { margin: 2rem 0; padding: clamp(0.75rem, 3vw, 1.5rem); border: 1px solid #ccc7d8; border-radius: 10px; background: #fff; color: #19213a; font-size: 0.875rem; line-height: 1.5; }
.position-example header h2 { margin: 0; font-size: 1.25rem; }
.position-example header p { color: #626272; font-size: 0.8rem; }
.position-example .position-decision { font-size: 1rem; }
.position-example .position-decision strong { font-size: 1.25rem; }
.position-warning { padding: 0.6rem; border-left: 3px solid #ae7b24; background: #fff9e9; }
:is(.position-example, .position-inline-preview) summary { cursor: pointer; font-weight: 600; }
.position-assumptions { margin: 1rem 0; padding: 0.6rem; background: #f6f5f8; border-radius: 5px; }
.position-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 1.25rem; padding: 4px; border-radius: 6px; background: #efedf3; }
.position-tabs button { flex: 1; padding: 0.5rem; border: 1px solid transparent; border-radius: 4px; color: #39445c; font: inherit; cursor: pointer; background: transparent; }
.position-tabs button[aria-selected="true"] { background: #fff; border-color: #c5c0d2; font-weight: 600; }
.position-example [hidden] { display: none; }
.position-panel > h3, .position-panel [data-position-preview] > h3 { margin: 1rem 0 0.5rem; font-size: 1.05rem; }
.position-example figure { margin: 0.75rem 0 1rem; }
.position-example figcaption { color: #626272; font-size: 0.75rem; line-height: 1.5; }
.position-chart { display: block; width: 100%; height: auto; overflow: visible; background: #fcfcfe; border: 1px solid #eeeaf3; border-radius: 5px; }
.position-chart text { fill: #606579; font: 11px system-ui, sans-serif; }
.position-chart-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0; padding: 0; list-style: none; color: #626272; font-size: 0.75rem; line-height: 1.5; }
.position-chart-legend li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.position-chart-legend svg { flex: 0 0 36px; width: 36px; height: 12px; }
.position-chart-legend .position-band { stroke: #89909e; stroke-width: 0.75; }
.position-grid { stroke: #e1dfeb; stroke-width: 1; }
.position-bin { fill: #8097cf; opacity: 0.25; }
.position-current { stroke: #343c52; stroke-dasharray: 4 3; stroke-width: 1.5; }
.position-average { stroke: #d900c8; stroke-width: 3; }
.position-after-buy { stroke: #159648; stroke-width: 2; stroke-dasharray: 2 3; }
.position-average-label { color: #a30098; }
.position-buy-label { color: #137c3c; }
.position-lot { fill: #3c5488; stroke: white; stroke-width: 1.5; }
.position-buy, .position-trade-buy { fill: #23ae59; stroke: #155b30; stroke-width: 1.5; }
.position-trade-sell { fill: #e7706d; stroke: #8b3338; stroke-width: 1; }
.position-target { stroke: #8960b6; stroke-dasharray: 6 4; stroke-width: 1.5; }
.position-price-line { fill: none; stroke: #4267b0; stroke-width: 2; stroke-linejoin: round; }
.position-band-buy { fill: #addfbe; }
.position-band-sell { fill: #f4c2c7; }
.position-band-wait { fill: #d5dbe5; }
.position-inspector-point { fill: #4267b0; stroke: #fff; stroke-width: 2; pointer-events: none; }
.position-inspector { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 1rem 0; }
.position-inspector label { display: flex; flex: 1; align-items: center; gap: 0.5rem; white-space: nowrap; }
.position-history-slider { width: 100%; min-width: 70px; accent-color: #4267b0; }
.position-history-readout { font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.position-table-wrap { width: 100%; overflow-x: auto; margin: 1rem 0; }
:is(.position-example, .position-inline-preview) table { display: table; width: 100%; border-collapse: collapse; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
:is(.position-example, .position-inline-preview) th { text-align: left; background: #f6f5f8; }
:is(.position-example, .position-inline-preview) :is(td, th) { padding: 0.5rem; border-bottom: 1px solid #e5e2eb; }
.position-example tr.is-selected { background: #e7edfc; }
.position-lot:is(.is-selected, :focus-visible) { stroke: #19213a; stroke-width: 3; outline: none; }
.position-preview-controls { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.position-preview-controls label { display: flex; align-items: center; gap: 0.5rem; }
.position-preview-controls select { font: inherit; color: inherit; background: #fff; border: 1px solid #c5c0d2; border-radius: 4px; padding: 0.35rem; }
.position-preview-note, .position-preview-summary { font-size: 0.8rem; color: #626272; }
.position-kelly-current { background: #e7edfc; font-weight: 600; }
.position-kelly-current-label { display: none; }
.position-kelly-current .position-kelly-current-label { display: inline; }
.position-kelly-reason { font-weight: 400; min-width: 12rem; }
.position-kelly-reason summary { overflow-wrap: anywhere; }
.position-kelly-reason p { white-space: pre-line; min-width: 16rem; max-width: 24rem; }

/* Mirror the index Trade Details chrome without its private stylesheet or logos. */
.blog-position-window { background: #eaeaea; box-shadow: 0 5px 18px rgb(0 0 0 / 20%); }
.blog-position-window.is-front { box-shadow: 0 12px 40px rgb(0 0 0 / 34%); }
.blog-position-window .blog-window-titlebar { height: 24px; min-height: 24px; padding: 3px 12px; background: linear-gradient(#f8f8f8, #e5e5e5); }
.blog-position-window .blog-window-title { margin: 0 76px 0 12px; line-height: 16px; }
.blog-position-window .blog-window-lights { gap: 9px; }
.blog-position-window .blog-window-light { width: 16px; height: 16px; border-radius: 50%; }
.blog-position-window .blog-window-content { display: flex; overflow: hidden; }
.blog-position-window .position-example { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; font-size: 13px; }
.blog-position-window .position-tabs { display: flex; flex-wrap: nowrap; flex: 0 0 auto; gap: 0; margin: 18px auto 12px; padding: 0; max-width: calc(100% - 20px); overflow-x: auto; border: 1px solid #a8a8a8; border-radius: 5px; background: none; }
.blog-position-window .position-tabs button { flex: 0 0 auto; padding: 6px 20px; border: 0; border-radius: 0; background: linear-gradient(#fff, #f2f2f2); color: #303030; font-weight: 400; white-space: nowrap; }
.blog-position-window .position-tabs button + button { border-left: 1px solid #a8a8a8; }
.blog-position-window .position-tabs button[aria-selected="true"] { background: #1679ef; color: #fff; }
.blog-position-window .position-tabs button:focus-visible { outline: 2px solid #19213a; outline-offset: -3px; }
.blog-position-window .position-detail-body { flex: 1; min-height: 0; margin: 0 10px 14px; padding: 12px; overflow: auto; overscroll-behavior: contain; border: 1px solid #a8a8a8; border-radius: 5px; background: #fff; }
.blog-position-window .position-panel > h3, .blog-position-window .position-panel [data-position-preview] > h3 { margin-top: 12px; }

.about-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100svh - 32px);
  margin: auto;
  padding: 62px 32px 28px;
  overflow-y: auto;
  border: 1px solid var(--chrome-border);
  border-radius: 24px;
  background: #fafafa;
  color: var(--chrome-text);
  text-align: center;
  box-shadow: 0 20px 70px rgb(0 0 0 / 30%);
}

.about-dialog::backdrop { background: rgb(0 0 0 / 25%); backdrop-filter: blur(4px); }
.about-window-controls { position: absolute; top: 18px; left: 18px; display: flex; gap: 10px; }
.about-close, .about-inactive-control { width: 16px; height: 16px; flex: 0 0 16px; border-radius: 50%; }
.about-inactive-control { background: #c7c7c7; border: 1px solid var(--chrome-border); }
.about-close { position: relative; padding: 0; border: 1px solid #de3841; background: #ff5f57; cursor: pointer; }
.about-close::after { content: '×'; position: absolute; inset: 0; color: #641c19; font: 15px/13px system-ui; opacity: 0; }
.about-close:is(:hover, :focus-visible)::after { opacity: 1; }
.about-app-icon { display: block; margin: 0 auto 20px; filter: drop-shadow(0 3px 3px rgb(0 0 0 / 20%)); }
.about-dialog h2 { margin: 0 0 10px; font-size: 26px; line-height: 1.2; font-weight: 700; }
.about-dialog p { margin: 10px 0; font-size: 13px; }

@keyframes gradient-drift {
  from {
    transform: translate(-4%, -3%) rotate(-6deg) scale(1);
  }
  to {
    transform: translate(4%, 3%) rotate(6deg) scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .background::before,
  .background::after {
    animation: none;
  }
}

@media (max-width: 720px) {
  .desktop-menubar { padding: 0 10px; }
  main { padding: calc(2rem + var(--menu-height)) 1rem 2rem; }
  .post-list li { grid-template-columns: minmax(0, 1fr); }
  .blog-window-titlebar { min-height: 40px; padding: 1px 4px; }
  .blog-window-light { width: 32px; height: 36px; }
  .blog-window-title { margin: 0 6px; }
  .blog-window-permalink { padding: 8px; }
  .blog-window .blog-content { padding: 1.25rem; }
  .blog-position-window .blog-window-titlebar { height: 40px; min-height: 40px; padding: 1px 4px; }
  .blog-position-window .blog-window-lights { gap: 3px; }
  .blog-position-window .blog-window-light { width: 32px; height: 36px; }
  .blog-position-window .blog-window-title { margin: 0 6px; }
  .blog-position-window .position-tabs { margin: 12px auto; }
  .blog-position-window .position-tabs button { padding: 10px 16px; }
}

@media (max-width: 480px) {
  .desktop-menubar { column-gap: 6px; }
  .desktop-app-name { padding: 0 6px 0 0; font-size: 12px; }
  .desktop-menu-label { padding: 0 6px; }
  .blog-disclaimer { max-width: 100px; font-size: 11px; line-height: 1.15; white-space: normal; text-align: right; }
  /* Anchor dropdowns to the whole toolbar so File stays within narrow screens. */
  .desktop-menu { position: static; }
}
