/* App-wide "modern" skin: brings every page after sign-in (and auth, docs, errors) into the
   landing page's design language - Helvetica Now, ink-on-studio-grey neutrals, pill buttons,
   large soft radii, calm shadows, generous whitespace.
   Loaded after app.css, so it works by (1) re-pointing the design tokens and (2) restyling
   components. Semantic colours are kept: green = up/buy/live, red = down/sell/danger.
   Helvetica Now ships in ONE weight per face, so nothing here asks for bold (browsers would
   fake it): emphasis uses the Medium display face at weight 400 instead. */

/* ============================================================= tokens */
:root {
  --font-heading: 'HelveticaNowDisplay-Medium', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'HelveticaNowDisplayW01-Rg', 'Helvetica Neue', Arial, sans-serif;

  --color-primary: #0b0b0c;
  --color-primary-strong: #000;
  --color-on-primary: #fff;
  --color-primary-soft: #efeff1;

  --color-bg: #f7f7f8;
  --color-surface: #fff;
  --color-surface-2: #f3f3f5;
  --color-surface-3: #e9e9ec;

  --color-fg: #0b0b0c;
  --color-fg-soft: #3a3a41;
  --color-muted-fg: #5f5f68;        /* 6:1 on the page background */

  --color-border: #e8e8ec;
  --color-border-strong: #d3d3d9;
  --color-info: #3a3a41;

  --ring: 0 0 0 2px #fff, 0 0 0 4px #0b0b0c;

  --radius-sm: 12px; --radius: 18px; --radius-lg: 24px;
  --shadow-xs: 0 1px 2px rgba(11, 11, 12, .04);
  --shadow-sm: 0 1px 2px rgba(11, 11, 12, .04), 0 14px 30px -20px rgba(11, 11, 12, .22);
  --shadow-md: 0 1px 2px rgba(11, 11, 12, .05), 0 20px 40px -22px rgba(11, 11, 12, .28);
  --shadow-lg: 0 1px 2px rgba(11, 11, 12, .06), 0 28px 56px -24px rgba(11, 11, 12, .34);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --sidebar-w: 256px;
}

body { font-size: 15px; letter-spacing: -.003em; }

/* emphasis without faux-bold */
strong, b, th, label, .btn, .badge, .nav a, .stat .label, .field-tag, .brand,
.settings-row-title, .docs-toc .kicker, .priority-option label, .ticket-info dd, .ind-source {
  font-family: var(--font-heading); font-weight: 400;
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 400; letter-spacing: -.02em; color: var(--color-fg); }
h1 { font-size: clamp(1.9rem, 3.2vw, 2.7rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { font-size: 1.3rem; line-height: 1.15; }
h3 { font-size: 1.08rem; }

a { color: var(--color-fg); }
p a:not(.btn), li a:not(.btn), td a:not(.btn), .hint a, .settings-row-desc a, label a {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  text-decoration-color: rgba(11, 11, 12, .35);
}
p a:not(.btn):hover, li a:not(.btn):hover, td a:not(.btn):hover { text-decoration-color: currentColor; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ============================================================= brand */
.brand { gap: 5px; color: var(--color-fg); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-text { font-size: 23px; letter-spacing: -.028em; line-height: 1; }
.brand-logo { display: block; flex: none; width: auto; height: 28px; user-select: none; -webkit-user-drag: none; }

/* ============================================================= app shell */
.app { background: var(--color-bg); grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.content { min-width: 0; }
@media (max-width: 900px) { .app { grid-template-columns: minmax(0, 1fr); } }
.main { max-width: 1240px; padding: 36px 44px 72px; }
.page-head { margin-bottom: 32px; gap: 16px 24px; align-items: flex-end; }
.page-head > div:first-child { min-width: 0; }
.page-head p { margin-top: 8px; font-size: 1.02rem; max-width: 60ch; }

@media (min-width: 901px) {
  /* Floating rounded rail instead of a full-height bordered column. */
  .sidebar {
    margin: 12px 0 12px 12px; top: 12px; height: calc(100dvh - 24px);
    border: 1px solid var(--color-border); border-radius: 28px;
    box-shadow: var(--shadow-sm); padding: 26px 14px 16px;
  }
  .brand { padding: 0 10px; }
}
.nav { gap: 2px; }
.nav a {
  padding: 10px 14px; border-radius: 999px; font-size: .95rem; color: var(--color-fg-soft);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.nav a:hover { background: var(--color-surface-2); color: var(--color-fg); }
.nav a.active { background: var(--color-fg); color: #fff; }
.nav a svg { width: 17px; height: 17px; }
.sidebar-foot { border-top: 1px solid var(--color-border); }
.userchip { border-radius: 999px; padding: 6px 8px; margin: 0; color: var(--color-fg-soft); }
.userchip .avatar { background: var(--color-fg); color: #fff; font-family: var(--font-heading); font-weight: 400; }

.topbar { background: rgba(247, 247, 248, .82); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom-color: var(--color-border); }
.topbar .brand-text { font-size: 20px; }
.topbar .brand-logo { height: 24px; }
@media (max-width: 900px) {
  .main { padding: 24px 16px 56px; }
  .sidebar { border-radius: 0 28px 28px 0; padding-top: 24px; }
  .app.nav-open::after { background: rgba(11, 11, 12, .4); }
}

/* first-paint rise for the page's top-level blocks (transform/opacity only) */
@keyframes am-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.main > * { animation: am-rise .5s var(--ease) both; }
.main > *:nth-child(2) { animation-delay: .05s; }
.main > *:nth-child(3) { animation-delay: .1s; }
.main > *:nth-child(4) { animation-delay: .15s; }
.main > *:nth-child(n+5) { animation-delay: .2s; }

/* ============================================================= buttons */
.btn {
  padding: 10px 20px; border-radius: 999px; font-size: .92rem; line-height: 1.2;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--color-fg); color: #fff; box-shadow: none; }
.btn-primary:hover { background: #2a2a30; }
.btn-ghost { background: var(--color-surface); color: var(--color-fg); border-color: var(--color-border-strong); box-shadow: none; }
.btn-ghost:hover { background: var(--color-fg); color: #fff; border-color: var(--color-fg); }
.btn-subtle { background: var(--color-surface-2); }
.btn-subtle:hover { background: var(--color-surface-3); }
.btn-danger { background: var(--color-surface); color: var(--color-danger); border-color: #f2b8b1; box-shadow: none; }
.btn-danger:hover { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-google { box-shadow: none; }
.btn-google:hover { background: var(--color-fg); color: #fff; border-color: var(--color-fg); }
@media (pointer: coarse) { .btn { min-height: 44px; } }

/* ============================================================= surfaces */
.card { border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 20px; }
.panel { border-radius: var(--radius); box-shadow: none; }
.grid { gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 821px) and (max-width: 1180px) { .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { border-radius: 20px; padding: 18px 22px; box-shadow: var(--shadow-sm); }
.stat .label { font-size: .7rem; letter-spacing: .09em; }
.stat .value { font-weight: 500; font-size: clamp(1.2rem, 2vw, 1.55rem); letter-spacing: -.02em; margin-top: 6px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .card { padding: 20px; } }

/* ============================================================= badges */
.badge { padding: 3px 11px; font-size: .68rem; letter-spacing: .07em; }
.badge.info, .badge.priority-medium { background: var(--color-surface-2); color: var(--color-fg); border-color: var(--color-border-strong); }
.field-tag { letter-spacing: .07em; }

/* ============================================================= forms */
label { font-size: .84rem; color: var(--color-fg-soft); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"],
input[type="search"], input[type="url"], select, textarea {
  padding: 11px 16px; border-radius: 14px; border-color: var(--color-border-strong); box-shadow: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
}
textarea { border-radius: 18px; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: #a9a9b3; }
input:focus, select:focus, textarea:focus { border-color: var(--color-fg); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: #8a8a94; }
select { background-position: right 14px center; padding-right: 38px; }
.checkbox input, .telemetry-row input { accent-color: var(--color-fg); }
.priority-option label { padding: 9px 16px; }
.priority-option input:focus-visible + label { outline: none; box-shadow: var(--ring); }
.priority-option.priority-medium input:checked + label { background: var(--color-fg); color: #fff; border-color: var(--color-fg); }
.priority-option.priority-low input:checked + label { background: var(--color-surface-3); }
.telemetry-row { border-radius: var(--radius); }
.diag-panel { border-radius: var(--radius); }

/* profile / settings */
.settings-section-head .icon-badge { border-radius: 14px; background: var(--color-fg); color: #fff; }
.settings-row-title { font-size: .95rem; }
.broker-account-row .broker-mark { border-radius: 14px; font-family: var(--font-heading); font-weight: 400; }
.profile-hero .avatar {
  display: grid; place-items: center; border-radius: 50%; overflow: hidden;
  background: var(--color-fg); color: #fff; font-family: var(--font-heading);
}

/* ============================================================= tables */
.table-wrap { border-radius: 20px; box-shadow: var(--shadow-xs); }
table.data th { font-size: .68rem; letter-spacing: .09em; padding: 12px 18px; background: var(--color-surface-2); }
table.data td { padding: 14px 18px; }
table.data tbody tr { transition: background-color .15s ease; }
table.data tbody tr:hover { background: #fafafb; }

/* ============================================================= toasts + dialog */
.flashes { top: 16px; right: 16px; }
.flash {
  --flash-c: var(--color-fg-soft);
  border-left: 1px solid var(--color-border); border-radius: 18px; padding: 12px 16px;
  box-shadow: var(--shadow-md); font-size: .9rem; align-items: center;
}
.flash::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--flash-c); }
.flash.success { --flash-c: var(--color-pos); border-left-color: var(--color-border); }
.flash.error { --flash-c: var(--color-danger); border-left-color: var(--color-border); }
.flash.warning { --flash-c: var(--color-warn); border-left-color: var(--color-border); }
.flash.info { --flash-c: var(--color-fg-soft); border-left-color: var(--color-border); }
dialog.confirm-dialog { border-radius: 28px; padding: 30px; box-shadow: var(--shadow-lg); }
dialog.confirm-dialog::backdrop { background: rgba(11, 11, 12, .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.confirm-dialog h3 { font-size: 1.35rem; letter-spacing: -.025em; }

/* ============================================================= auth + error pages */
/* the studio gradient lives on the body */
body:has(.auth-wrap) { background: radial-gradient(120% 90% at 70% 40%, #f4f4f5 0%, #e7e7e9 100%) fixed; }
.auth-wrap { min-height: 100dvh; padding: 24px; }
.auth-card {
  max-width: 440px; border-radius: 32px; padding: 44px 40px; border-color: rgba(11, 11, 12, .07);
  box-shadow: 0 1px 2px rgba(11, 11, 12, .05), 0 32px 64px -32px rgba(11, 11, 12, .3);
}
.auth-card .brand { margin-bottom: 28px; }
.auth-card h1 { font-size: 2rem; letter-spacing: -.035em; margin-bottom: 24px; }
.auth-card .btn-primary { padding-block: 13px; }
.divider { margin: 22px 0; }
@media (max-width: 480px) { .auth-card { padding: 32px 22px; border-radius: 28px; } }

/* ============================================================= strategies + builder */
.strat-grid { gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.strat-card { border-radius: 24px; padding: 24px; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s ease; }
.strat-card:hover { transform: translateY(-3px); border-color: var(--color-border-strong); box-shadow: var(--shadow-md); }
.cond-group { border-radius: 24px; padding: 24px; box-shadow: var(--shadow-sm); }
.block { border-radius: var(--radius); }
/* indicator parameter fields: label always stacked above its control */
.block label.small { display: flex; flex-direction: column; gap: 4px; }
.block .param-input { width: 92px; }
.block .block-ctl button { border-radius: 10px; }
.connector button { padding: 5px 18px; min-height: 30px; }
.actionbar { background: linear-gradient(180deg, rgba(247, 247, 248, 0), var(--color-bg) 42%); }
.indicator-readout .ind { border-radius: 14px; }

/* ----- instrument combobox (strategy builder) ----- */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none; max-height: 320px; overflow-y: auto;
  background: var(--color-surface); border: 1px solid var(--color-border-strong);
  border-radius: 16px; box-shadow: var(--shadow-lg); overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent;
  animation: combo-in .14s var(--ease) both;
}
.combo-list[hidden] { display: none; }
@keyframes combo-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.combo-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 8px 12px; border-radius: 11px; cursor: pointer;
}
.combo-opt[aria-selected="true"] { background: var(--color-surface-2); }
.combo-main { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.combo-sym { font-family: var(--font-heading); color: var(--color-fg); letter-spacing: .01em; }
.combo-sym mark { background: none; color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.combo-name { font-size: .78rem; color: var(--color-muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-meta { display: flex; gap: 6px; flex: none; }
.combo-chip {
  padding: 2px 9px; border-radius: 999px; font-size: .7rem; letter-spacing: .04em;
  text-transform: uppercase; background: var(--color-surface-3); color: var(--color-fg-soft);
}
.combo-kind { background: transparent; border: 1px solid var(--color-border-strong); text-transform: none; letter-spacing: 0; }
.combo-empty { padding: 14px 12px; font-size: .85rem; color: var(--color-muted-fg); }
@media (max-width: 560px) { .combo-kind { display: none; } }
@media (prefers-reduced-motion: reduce) { .combo-list { animation: none; } }

.callout { border-radius: var(--radius); padding: 16px 20px; }
.callout.tip { background: var(--color-surface-2); border-color: var(--color-border-strong); }

/* standalone docs header: same frosted bar as the landing nav */
.landing-header {
  max-width: none; padding: 16px 32px; background: rgba(247, 247, 248, .8);
  border-bottom: 1px solid var(--color-border);
}
.docs-standalone { padding-top: 40px; }
@media (max-width: 640px) { .landing-header { padding: 14px 16px; } }

/* ============================================================= timeline + analytics */
.timeline-item::before { border-color: var(--color-fg); }
.wl-bar { height: 8px; }

@media (prefers-reduced-motion: reduce) {
  .main > * { animation: none; }
  .strat-card:hover { transform: none; }
}

/* support form: shortcut buttons under the Description box */
.description-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-top: 10px; }
.description-tools .hint { margin: 0 4px 0 0; }

/* ----- time field (strategy builder: "Time of day" conditions) -----
   A calm white card: two labelled digit tiles, a 12-hour readout, the trading session as a slider, text nudges and quick times.
   One accent (the app blue) on a neutral ink; every control is a real input/button with a visible focus ring. */
.timefield { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 14px 14px 12px; border-radius: 18px; background: var(--color-surface); border: 1px solid var(--color-border-strong); box-shadow: var(--shadow-xs, none); }
.timefield .tf-top { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.timefield .tf-ic { display: grid; place-items: center; flex: none; color: var(--color-primary); }
.timefield .tf-readline { display: flex; align-items: center; gap: 8px; }
.timefield .tf-box { display: inline-flex; align-items: flex-end; gap: 6px; }
.timefield .tf-cell { position: relative; display: flex; flex-direction: column; align-items: center; width: 58px; padding: 7px 4px 5px; border-radius: 12px; background: var(--color-surface-2); border: 1px solid transparent; transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background-color .18s var(--ease); }
.timefield .tf-cell:hover { border-color: var(--color-border-strong); }
.timefield .tf-cell:focus-within { background: var(--color-surface); border-color: var(--color-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent); }
.timefield .tf-lab { font-size: .58rem; font-weight: 700; letter-spacing: .12em; color: var(--color-muted-fg); line-height: 1; }
.block .timefield .tf-seg {
  width: 100%; min-width: 0; height: auto; min-height: 0; padding: 2px 0 0; margin: 0; border: 0; border-radius: 8px; background: transparent; box-shadow: none;
  font: 600 1.55rem/1.15 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; text-align: center; color: var(--color-fg); caret-color: var(--color-primary);
}
.block .timefield .tf-seg:focus { outline: none; background: transparent; color: var(--color-primary-strong); }
.timefield .tf-seg::selection { background: color-mix(in srgb, var(--color-primary) 18%, transparent); color: var(--color-primary-strong); }
.timefield .tf-colon { align-self: center; font: 500 1.5rem/1 var(--font-mono); color: var(--color-border-strong); padding-top: 12px; }
.timefield .tf-ist { align-self: center; margin-left: 2px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--color-border-strong); color: var(--color-muted-fg); font: 700 .62rem/1.5 var(--font-mono); letter-spacing: .1em; }
.timefield .tf-read { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.timefield .tf-human { font-size: 1.12rem; font-weight: 650; color: var(--color-fg); letter-spacing: -.01em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timefield .tf-note { font-size: .74rem; color: var(--color-warn); line-height: 1.3; }
.timefield .tf-note[hidden] { display: none; }

/* the session: open on the left, close on the right; a thumb you can drag or move with the arrow keys */
.timefield .tf-timeline { display: flex; flex-direction: column; gap: 4px; }
.timefield .tf-rangewrap { position: relative; padding: 6px 0 12px; }
.timefield .tf-range { --tf-pos: 0%; display: block; width: 100%; height: 6px; margin: 0; padding: 0; min-height: 0; border: 0; border-radius: 999px; cursor: pointer; -webkit-appearance: none; appearance: none;
  background: linear-gradient(90deg, var(--color-primary) var(--tf-pos), var(--color-surface-3) var(--tf-pos)); }
.timefield .tf-range:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 6px; }
.timefield .tf-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--color-surface); border: 3px solid var(--color-primary); box-shadow: 0 1px 4px rgba(16, 24, 40, .22); transition: transform .12s var(--ease); }
.timefield .tf-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--color-surface); border: 3px solid var(--color-primary); box-shadow: 0 1px 4px rgba(16, 24, 40, .22); }
.timefield .tf-range::-moz-range-track { background: transparent; height: 6px; }
.timefield .tf-range:active::-webkit-slider-thumb { transform: scale(1.12); }
.timefield .tf-ticks { position: absolute; left: 11px; right: 11px; bottom: 2px; height: 6px; pointer-events: none; }
.timefield .tf-ticks i { position: absolute; top: 0; width: 1px; height: 6px; background: var(--color-border-strong); }
.timefield .tf-ends { display: flex; justify-content: space-between; font-size: .7rem; color: var(--color-muted-fg); }
.timefield .tf-ends b { font: 600 .74rem var(--font-mono); color: var(--color-fg-soft); letter-spacing: 0; }

.timefield .tf-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding-top: 12px; border-top: 1px solid var(--color-border); }
.timefield .tf-nudges { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--color-surface-2); border: 1px solid var(--color-border); }
.block .timefield .tf-nudge {
  min-width: 0; height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--color-fg-soft); cursor: pointer;
  font: 600 .76rem/1 var(--font-mono); white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease), transform .12s var(--ease);
}
.block .timefield .tf-nudge:hover { background: var(--color-surface); color: var(--color-fg); box-shadow: var(--shadow-xs, none); }
.block .timefield .tf-nudge:active { transform: scale(.96); }
.timefield .tf-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.block .timefield .tf-chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 3px 11px; border-radius: 999px; cursor: pointer; background: transparent;
  border: 1px solid var(--color-border-strong); color: var(--color-fg-soft); font-size: .78rem; font-variant-numeric: tabular-nums;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.block .timefield .tf-chip:hover { border-color: var(--color-fg-soft); background: var(--color-surface-2); }
.block .timefield .tf-chip[aria-pressed="true"] { background: var(--color-fg); border-color: var(--color-fg); color: #fff; }
.timefield .tf-chip-l { font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--color-muted-fg); }
.timefield .tf-chip[aria-pressed="true"] .tf-chip-l { color: rgba(255, 255, 255, .72); }
.block .timefield .tf-nudge:focus-visible, .block .timefield .tf-chip:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
@media (max-width: 640px) {
  .timefield .tf-cell { width: 64px; }
  .block .timefield .tf-nudge { height: 44px; padding: 0 16px; }
  .block .timefield .tf-chip { min-height: 44px; padding: 3px 14px; }
  .timefield .tf-nudges { padding: 2px; }
  .timefield .tf-range::-webkit-slider-thumb { width: 28px; height: 28px; }
  .timefield .tf-ticks { left: 14px; right: 14px; }
}
@media (prefers-reduced-motion: reduce) { .timefield .tf-cell, .block .timefield .tf-nudge, .block .timefield .tf-chip, .timefield .tf-range::-webkit-slider-thumb { transition: none; } }

/* ----- broker profile (read-only details fetched from the broker) ----- */
.profile-dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 24px; margin: var(--space-lg) 0 0; }
.profile-dl dt { font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: var(--color-muted-fg); margin: 0 0 3px; }
.profile-dl dd { margin: 0; overflow-wrap: anywhere; }

/* =====================================================================================================================
   Strategy builder: every condition as three clearly different lanes (LEFT - OPERATOR - RIGHT)
   ===================================================================================================================== */

/* ----- the four steps ----- */
.build-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 var(--space-xl); padding: 0; }
.build-steps li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--color-surface); border: 1px solid var(--color-border-strong); color: var(--color-muted-fg); font-size: .84rem; font-weight: 600; }
.build-steps li > span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--color-surface-3); color: var(--color-fg-soft); font-size: .76rem; }
.build-steps li.is-current { color: var(--color-primary-strong); border-color: var(--color-primary); background: var(--color-primary-soft); }
.build-steps li.is-current > span { background: var(--color-primary); color: var(--color-on-primary); }
.build-steps li.is-done { color: var(--color-pos); border-color: #a6f4c5; background: var(--color-pos-bg); }
.build-steps li.is-done > span { background: var(--color-pos); color: #fff; }

/* ----- how to read a condition ----- */
.lane-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 var(--space-xl); padding: 12px 16px; border-radius: 14px; background: var(--color-surface); border: 1px solid var(--color-border); font-size: .85rem; color: var(--color-fg-soft); }
.lane-legend .lg { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--lane-edge); background: var(--lane-bg); color: var(--lane-ink); }
.lane-legend .lg i { width: 8px; height: 8px; border-radius: 50%; background: var(--lane-ink); }
.lane-legend .sep { color: var(--color-muted-fg); }
.lg-left, .lane-left { --lane-ink: #1d4ed8; --lane-bg: #f3f7ff; --lane-edge: #c4d6fb; }
.lg-op, .lane-op { --lane-ink: #344054; --lane-bg: #f2f4f7; --lane-edge: #cfd4dc; }
.lg-right, .lane-right { --lane-ink: #0e7490; --lane-bg: #f0fbfd; --lane-edge: #b3e2ea; }

/* ----- a condition = a header, three lanes, and a plain-language line ----- */
.cond-group { container-type: inline-size; }
.block { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: 16px; box-shadow: var(--shadow-xs); }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.block-num { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 700; color: var(--color-fg-soft); }
.block-num b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--color-fg); color: #fff; font-size: .78rem; }
.block .block-ctl { flex-direction: row; gap: 6px; align-items: center; }
.block .block-ctl button { width: 36px; height: 36px; border-radius: 10px; }
.block .block-ctl button[aria-label="Delete condition"]:hover { color: var(--color-danger); background: var(--color-danger-bg); border-color: #f2b8b1; }
.block-lanes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(172px, .8fr) minmax(0, 1fr); gap: 8px; align-items: stretch; }
.lane { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 9px 10px 11px; border-radius: 14px; background: var(--lane-bg); border: 1px solid var(--lane-edge); border-top: 4px solid var(--lane-ink); }
.lane-cap { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-size: .72rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--lane-ink); }
.lane-cap small { font-size: .76rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--color-muted-fg); }
.lane-dot { align-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--lane-ink); }
.lane-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; justify-content: center; }
.lane select, .lane input:not(.tf-seg):not(.tf-range) { min-height: 42px; background: var(--color-surface); border-color: var(--color-border-strong); }
.lane-op select { font-weight: 700; color: var(--color-fg); width: 100%; border: 2px solid var(--lane-ink); border-radius: 12px; text-overflow: ellipsis; }
.lane select { min-width: 0; text-overflow: ellipsis; padding-left: 10px; padding-right: 30px; font-size: .9rem; }
.lane input[type=number]:not(.param-input) { width: 96px !important; min-width: 0; }
.lane-hint { font-size: .78rem; color: var(--color-muted-fg); text-align: center; }
.lane-hint[hidden] { display: none; }
.lane-body > .row { align-items: flex-end; }
.block-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; border-top: 1px dashed var(--color-border-strong); }
.block-reads { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-width: 0; font-size: .84rem; }
.block-reads-k { font-size: .68rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--color-muted-fg); }
.block-reads-v { font-family: var(--font-mono); color: var(--color-fg); overflow-wrap: anywhere; }
.block:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.time-hint { margin: -4px 4px 0; }

/* a time-of-day condition: the clock needs more room than a number, the "Time of day" label on the left needs less */
.block-lanes.has-time { grid-template-columns: minmax(108px, .4fr) minmax(172px, .7fr) minmax(280px, 1.6fr); }
.lane .timefield .tf-box { max-width: 100%; }
@container (max-width: 520px) {
  .block-lanes, .block-lanes.has-time { grid-template-columns: 1fr; }
}
@container (max-width: 580px) {
  .block-lanes.has-time { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .lane select, .lane input:not(.tf-seg):not(.tf-range) { min-height: 46px; }
  .block .block-ctl button { width: 44px; height: 44px; }
  .build-steps li { font-size: .8rem; }
}
.form-step { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--space-lg); font-size: 1.02rem; }
.form-step .step-dot { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--color-fg); color: #fff; font-size: .8rem; font-weight: 700; }
.stack > .form-step { margin-top: 0; }

/* ----- field help: the (?) after a field and the bubble it opens (static/js/tooltips.js) ----- */
.tm-tip-btn { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; padding: 0; vertical-align: 1px; border-radius: 50%;
  border: 1.5px solid var(--color-border-strong, #98a2b3); background: var(--color-surface); color: var(--color-muted-fg); font: 700 .68rem/1 var(--font-body, inherit);
  cursor: help; transition: background .15s, color .15s, border-color .15s; }
.tm-tip-btn:hover, .tm-tip-btn[aria-expanded="true"] { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.tm-tip-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--color-primary) 40%, transparent); outline-offset: 2px; }
.field > label[data-tip], .field-label-row > label[data-tip] { display: inline-block; }
.field-label-row:has(.tm-tip-btn) { justify-content: flex-start; gap: 0; }
table.data th[data-tip-done] { white-space: nowrap; }                 /* a column heading and its (?) stay on one line */
table.data th .tm-tip-btn { margin-left: 4px; }
.field-label-row:has(.tm-tip-btn) .field-tag { margin-left: auto; }
.tm-tip { position: fixed; z-index: 2000; max-width: min(300px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 12px; background: #101828; color: #f2f4f7;
  font-size: .82rem; line-height: 1.5; font-weight: 400; letter-spacing: 0; text-transform: none; box-shadow: 0 10px 30px rgba(16, 24, 40, .28); pointer-events: none; }
.tm-tip::after { content: ""; position: absolute; left: var(--tip-x, 50%); bottom: -5px; width: 10px; height: 10px; margin-left: -5px; background: #101828; transform: rotate(45deg); }
.tm-tip.is-below::after { bottom: auto; top: -5px; }
.tm-tip[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) { .tm-tip:not([hidden]) { animation: tm-tip-in .12s ease-out; } }
@keyframes tm-tip-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.tm-tip-wrap { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
.tm-tip-wrap > .tm-tip-btn { margin-left: 0; flex: none; }
.tm-tip-wrap > select, .tm-tip-wrap > input { min-width: 0; }
.lane-cap .tm-tip-btn { margin-left: 8px; vertical-align: middle; }
@media (max-width: 820px) { .tm-tip-btn { width: 24px; height: 24px; font-size: .78rem; } }

/* ----- profile: the saved / missing details of a broker connection ----- */
.cred-block { margin: -2px 0 var(--space-lg); padding: var(--space-lg); border: 1px solid var(--color-border); border-radius: 14px; background: var(--color-surface-2); }
.cred-block .cred-title { margin-bottom: var(--space-md); }
.cred-block .field { margin-bottom: var(--space-md); }
.cred-block .cred-have { margin: var(--space-md) 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cred-level { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: var(--color-surface-3, #eef0f2); color: var(--color-muted-fg); }
.cred-level.required { background: #fef3f2; color: #b42318; }
.cred-level.recommended { background: #fffaeb; color: #b54708; }

/* ----- the "log in to your broker again" notice at the top of every signed-in page ----- */
.session-notice { display: flex; align-items: flex-start; gap: var(--space-md); margin: 0 0 var(--space-lg); padding: 14px 18px; border-radius: 16px; border: 1px solid; }
.session-notice[hidden] { display: none; }
.session-notice .sn-ic { flex: none; margin-top: 2px; }
.session-notice .sn-body { flex: 1; min-width: 0; }
.session-notice .sn-body p { margin: 2px 0 0; font-size: .92rem; line-height: 1.45; }
.session-notice .sn-hint { opacity: .85; font-size: .85rem; }
.session-notice .sn-act { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.session-notice.now { background: #fef3f2; border-color: #fecdca; color: #7a271a; }
.session-notice.daily { background: #eff8ff; border-color: #b2ddff; color: #194185; }
@media (max-width: 720px) { .session-notice { flex-wrap: wrap; } .session-notice .sn-act { width: 100%; justify-content: flex-start; } }

/* ----- the one-time platform tour: a dismissible nudge, then a small tooltip that follows you from page to
   page - never a blocking modal you have to read in one sitting. ----- */
.tour-nudge {
  position: fixed; z-index: 2050; right: 20px; bottom: 20px; width: min(320px, calc(100vw - 32px));
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 18px 18px 16px; animation: am-rise .3s var(--ease) both;
}
.tour-nudge .tn-row { display: flex; align-items: flex-start; gap: 10px; }
.tour-nudge .tn-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--color-fg); color: #fff; }
.tour-nudge h4 { margin: 2px 0 4px; font-size: .98rem; }
.tour-nudge p { margin: 0; font-size: .86rem; color: var(--color-fg-soft); line-height: 1.5; }
.tour-nudge .tn-actions { display: flex; gap: 8px; margin-top: 14px; }
.tour-nudge .tn-close { position: absolute; top: 10px; right: 10px; }

.tour-pop {
  position: fixed; z-index: 2050; width: min(300px, calc(100vw - 32px));
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 16px 18px;
}
.tour-pop .tp-close { position: absolute; top: 10px; right: 10px; }
.tour-pop h4 { margin: 0 10px 6px 0; font-size: .96rem; padding-right: 20px; }
.tour-pop p { margin: 0; font-size: .86rem; color: var(--color-fg-soft); line-height: 1.55; }
.tour-pop .tp-dots { display: flex; gap: 6px; margin: 12px 0; }
.tour-pop .tp-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--color-border-strong); }
.tour-pop .tp-dots span.on { background: var(--color-fg); }
.tour-pop .tp-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-pop .tp-foot .btn[hidden] { display: none; }
.tour-pop::before {                                        /* a small arrow pointing at the highlighted item */
  content: ""; position: absolute; width: 10px; height: 10px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-right: 0; border-bottom: 0;
}
.tour-pop.arrow-left::before { left: -6px; top: 20px; transform: rotate(-45deg); }
.tour-pop.arrow-top::before { top: -6px; left: 24px; transform: rotate(45deg); }
.tour-spot { position: relative; z-index: 2049; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--color-fg), 0 0 0 2000px rgba(16, 24, 40, .45); border-radius: 10px; }
