/* Dialogs and controls: trade form, date/time dropdowns, notes editor, filter drawer, viewers and toast. */
dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow: visible;
}
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(6px); }
/* A dialog grows out of the middle of the window over its dimmed, blurred page. */
@media (prefers-reduced-motion: no-preference) {
  dialog[open] > :first-child { animation: rise 240ms var(--ease-out); }
  dialog[open]::backdrop { animation: dim 240ms ease-out; }
  @keyframes rise { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes dim { from { opacity: 0; } to { opacity: 1; } }
}

/* trade form sheet */
.sheet {
  width: 880px;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--paper-hi);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-deep);
}
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 22px 28px;
  background: var(--grad-night);
  color: var(--night-fg);
}
.sheet-head h2 { font-size: 26px; letter-spacing: -0.03em; }
.sheet-head .soft, .drawer-head .soft { color: var(--night-muted); }
.sheet-head .icon-btn, .drawer-head .icon-btn, .reader-head .icon-btn { background: var(--night-3); color: var(--night-fg); box-shadow: none; }
.sheet-body { padding: 24px 28px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.sheet-foot {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 28px;
  background: var(--paper-hi);
  border-top: 1px solid var(--line);
}
@media (max-width: 640px) {
  .sheet-body { grid-template-columns: minmax(0, 1fr); padding: 20px; }
  .sheet-head, .sheet-foot { padding-inline: 20px; }
}

.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field.full { grid-column: 1 / -1; }
.field > label, .field > .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.input {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  padding: 12px 14px;
  background: var(--card);
  box-shadow: var(--shadow-chip);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.input:focus { outline: none; border-color: var(--ink); }
select.input { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%230E0E0C' stroke-width='1.6'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.field.invalid .input, .field.invalid .editor { border-color: var(--loss); }
.hint { font-size: 12px; color: var(--muted); }
.error { font-size: 12px; color: var(--loss); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button {
  border: 0;
  border-radius: 4px;
  padding: 4px 9px;
  background: var(--paper-lo);
  font-size: 12px;
  font-weight: 500;
}
.quick button:hover { background: var(--line); }
.pnl-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--grad-night);
  color: var(--night-fg);
}
.pnl-preview .figure { min-width: 0; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pnl-preview .gain { color: var(--gain-night); }
.pnl-preview .loss { color: var(--loss-night); }
.pnl-preview small { color: var(--night-muted); font-size: 12px; text-align: right; }
.field .hint a { color: var(--ink); font-weight: 600; }

/* Fills after the entry: exits at targets and added contracts, one row each (js/form.js) */
.fills { gap: 10px; }
.fills-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fills-state { font-size: 12px; color: var(--muted); }
.fills-state span { display: inline-block; margin-right: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.fills-state .state-open { background: var(--ink); color: var(--card); }
.fills-state .state-closed { background: var(--paper-lo); color: var(--ink-2); }
.fill-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fill-list[hidden] { display: none; }
.fill-row {
  display: grid;
  grid-template-columns: 56px 76px 12px minmax(90px, 1fr) minmax(130px, 150px) minmax(96px, 110px) 32px;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--paper-hi);
}
.fill-row .input { min-width: 0; padding: 8px 10px; font-size: 14px; }
.fill-kind { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.fill-row.add .fill-kind { color: var(--muted); }
.fill-at { color: var(--muted); text-align: center; }
.fill-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) {
  .fill-row { grid-template-columns: 48px 64px minmax(0, 1fr) 32px; }
  .fill-at { display: none; }
  .fill-row [data-k="date"] { grid-column: 1 / 3; }
  .fill-row [data-k="time"] { grid-column: 3 / 5; }
  .fill-row [data-remove-fill] { grid-row: 1; grid-column: 4; }
}
/* a trade logged as a result in R, before fills */
.legacy-result { display: grid; gap: 12px; }
.legacy-result[hidden], .fills[hidden] { display: none; }
.legacy-result .hint { margin: 0; }
.legacy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
@media (max-width: 640px) { .legacy-grid { grid-template-columns: minmax(0, 1fr); } }
/* "More details": what a trade can do without, folded away */
.form-more { border-top: 1px solid var(--line-soft); padding-top: 6px; }
.form-more summary { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; cursor: pointer; font-size: 14px; font-weight: 700; list-style: none; }
.form-more summary::-webkit-details-marker { display: none; }
.form-more summary::before { content: "+"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; background: var(--paper-lo); font-weight: 700; }
.form-more[open] summary::before { content: "−"; }
.form-more summary small { font-size: 12px; font-weight: 500; color: var(--muted); }
.form-more-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; padding-top: 8px; }
.form-more-body > .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-more-body { grid-template-columns: minmax(0, 1fr); } }

/* "Execution details": a divider row in the form grid */
.section-label {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.section-label span { font-size: 13px; font-weight: 600; color: var(--ink); }
.section-label small { font-size: 12px; color: var(--muted); }

/* the trader's rating, A+ to F, monochrome like the setup grades */
.letter-rating { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.letter-rating button {
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.letter-rating button:hover { border-color: var(--ink-3); color: var(--ink); }
.letter-rating button[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); }
.letter-rating button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.letter-rating .hint { margin-left: 6px; }
.picker-value.placeholder { color: var(--muted); }

/* dropdown pickers */
.picker { position: relative; min-width: 0; }
.picker-button { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; }
.picker.open .picker-button { border-color: var(--ink); }
.popover {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  width: 300px;
  max-width: calc(100vw - 48px);
  padding: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 24px 48px -16px rgba(0,0,0,.35);
}
.popover.up { top: auto; bottom: calc(100% + 6px); }
.popover.right { left: auto; right: 0; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dp-head strong { font-size: 15px; letter-spacing: -0.01em; }
.dp-nav { width: 32px; height: 32px; border: 0; border-radius: var(--radius-btn); background: var(--paper-lo); display: grid; place-items: center; }
.dp-nav:hover { background: var(--line); }
.dp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.dp-wd { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0 6px; }
.dp-day {
  aspect-ratio: 1;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.dp-day:hover { background: var(--paper-lo); }
.dp-day.out { color: var(--faint); }
.dp-day.today { box-shadow: inset 0 0 0 1.5px var(--ink); }
.dp-day.on { background: var(--grad-ink); color: var(--on-ink); box-shadow: none; }
.dp-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.time-pop { width: 220px; }
.tp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-col { display: grid; gap: 2px; max-height: 216px; overflow-y: auto; overflow-x: hidden; }
.tp-col-label { position: sticky; top: 0; background: var(--card); font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 2px 0 6px; text-align: center; }
.tp-opt { border: 0; border-radius: 6px; background: transparent; padding: 7px 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.tp-opt:hover { background: var(--paper-lo); }
.tp-opt.on { background: var(--grad-ink); color: var(--on-ink); }

/* rich-text notes */
.editor {
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-chip);
}
.editor:focus-within { border-color: var(--ink); }
.toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
}
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.tool {
  min-width: 32px;
  height: 32px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
  color: var(--ink-2);
}
.tool:hover { background: var(--paper-lo); color: var(--ink); }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.tool-select {
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: var(--paper-lo);
  padding: 0 8px;
  font-size: 13px;
  font-weight: 500;
}
.tool-menu { position: relative; display: inline-flex; }
.tool-font { width: 150px; }
.tool-size { width: 64px; }
/* Insert: a post from X, a YouTube video or an image, from a link */
.tool-insert { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 0 10px; font-size: 13px; font-weight: 600; }
.insert-pop { width: 340px; display: grid; gap: 10px; padding: 12px; }
.insert-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.insert-kinds button { display: grid; justify-items: center; gap: 4px; padding: 10px 6px; border: 1.5px solid var(--line); border-radius: var(--radius-btn); background: var(--card); color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.insert-kinds button:hover { border-color: var(--ink-3); }
.insert-kinds button[aria-checked="true"] { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.insert-x { font-size: 17px; font-weight: 800; line-height: 18px; }
.insert-pop .input { padding: 9px 11px; font-size: 13px; }
.insert-foot { display: flex; justify-content: flex-end; }
/* an inserted post or video: the site's own player, a block of its own in the text */
.prose .embed { position: relative; display: block; margin: .8em 0; max-width: 100%; }
/* in the editor: take the post or video out again */
.embed-remove {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border: 0; border-radius: var(--radius-btn); background: var(--ink); color: var(--on-ink);
  font: inherit; font-size: 12px; font-weight: 600; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow-deep); opacity: .92;
}
.embed-remove:hover, .embed-remove:focus-visible { opacity: 1; outline: 2px solid var(--card); outline-offset: 1px; }
.prose .embed iframe { display: block; width: 100%; border: 0; border-radius: 10px; background: var(--paper-lo); }
.prose .embed-youtube { max-width: 720px; }
.prose .embed-youtube iframe { aspect-ratio: 16 / 9; height: auto; }
.prose .embed-x { max-width: 550px; }
.prose .embed-x iframe { height: 520px; }
.tool .swatch-bar { display: block; width: 16px; height: 3px; border-radius: 2px; margin-top: 2px; }
.swatches { width: auto; display: grid; grid-template-columns: repeat(6, 28px); gap: 6px; padding: 10px; }
/* colour menus: the swatches, then any colour by red, green and blue */
.colour-pop { width: auto; padding: 0; }
.colour-pop .swatches { padding: 12px 12px 8px; }
.rgb { display: grid; grid-template-columns: 34px repeat(3, 52px); gap: 8px; align-items: end; padding: 8px 12px 12px; border-top: 1px solid var(--line-soft); }
.rgb input[type="color"] { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-btn); background: none; cursor: pointer; }
.rgb input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.rgb input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; }
.rgb-channel { display: grid; gap: 3px; font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--muted); }
.rgb-channel input, .rgb-hex { width: 100%; height: 34px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--radius-btn); background: var(--paper-hi);
  font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); }
.rgb-hex { grid-column: 1 / 3; text-transform: uppercase; }
.rgb .btn { grid-column: 3 / 5; justify-content: center; height: 34px; }
.tool-script { font-size: 14px; font-weight: 600; }
.tool-script sup, .tool-script sub { font-size: 9px; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); }
.swatches button:hover { transform: scale(1.08); }
.swatches .none { background: linear-gradient(135deg, #FFFFFF 45%, var(--loss) 45%, var(--loss) 55%, #FFFFFF 55%); }
.editor-body {
  /* --free-room: how far down the lowest free image reaches (js/editor.js) */
  min-height: max(260px, var(--free-room, 0px));
  max-height: 520px;
  overflow-y: auto;
  padding: 16px 18px;
  outline: none;
  line-height: 1.6;
  font-size: 15px;
}
.editor-body:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.editor-foot { display: flex; justify-content: space-between; flex-direction: row-reverse; gap: 12px; padding: 6px 12px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }

/* notes typography, shared by the editor and the reader */
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose div { margin: 0 0 .6em; }
.prose h2 { font-size: 22px; letter-spacing: -0.02em; margin: .8em 0 .35em; }
.prose h3 { font-size: 17px; letter-spacing: -0.01em; margin: .8em 0 .3em; }
.prose ul, .prose ol { margin: 0 0 .6em; padding-left: 1.4em; }
.prose img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  margin: .5em 0 .7em;
  border-radius: 8px;
  background: var(--night-2);
  box-shadow: var(--shadow-chip);
}
.prose img[data-pending] { opacity: .85; outline: 2px dashed var(--line); outline-offset: 2px; }
/* An image given a size keeps it (the share of the note's width); the 420px cap is only for images left at their own size. */
.prose img[style*="width"] { max-height: none; height: auto; }
/* text wrapped beside an image, and the note closing below the last one */
.prose img[style*="float: left"] { margin: .3em 1.4em .8em 0; }
.prose img[style*="float: right"] { margin: .3em 0 .8em 1.4em; }
.prose::after { content: ""; display: block; clear: both; }
/* Free images (dragged anywhere) are placed against the note itself, over the text. */
.prose { position: relative; }
.prose img[style*="absolute"] { z-index: 1; margin-left: 0; margin-right: 0; }
.prose h4 { font-size: 15px; letter-spacing: 0; margin: .8em 0 .25em; text-transform: uppercase; color: var(--ink-2); }
.prose code { padding: 1px 6px; border-radius: 4px; background: var(--paper-lo); font-size: .92em; font-variant-numeric: tabular-nums; }
.prose sup, .prose sub { font-size: .72em; }

/* Resizing images in the editor: a frame over the picked image, handles in its bottom corners, sizes above it. */
.editor { position: relative; }
.editor-body img { cursor: pointer; }
.editor-body img.picked { outline: 2px solid var(--ink); outline-offset: 2px; }
.img-frame { position: absolute; z-index: 5; pointer-events: none; }
.img-frame[hidden] { display: none; }
/* the handles sit on the image's own box, turned with it */
.img-box { position: absolute; inset: 0; }
.img-handle { position: absolute; width: 14px; height: 14px; border-radius: 3px; background: var(--card); border: 2px solid var(--ink); pointer-events: auto; touch-action: none; }
.img-handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.img-handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.img-handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.img-handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
/* the turning handle: a ring on a short stem above the image */
.img-rotate { position: absolute; left: 50%; top: -38px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--card);
  border: 2px solid var(--ink); pointer-events: auto; touch-action: none; cursor: grab; }
.img-rotate::after { content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 18px; margin-left: -1px; background: var(--ink); }
.img-frame.bar-below .img-rotate { top: auto; bottom: -38px; }
.img-frame.bar-below .img-rotate::after { top: auto; bottom: 100%; }
.editor-body img.moving { cursor: grabbing; box-shadow: var(--shadow-deep); }
.editor-body img.picked { cursor: grab; }
.img-bar { position: absolute; left: 0; bottom: calc(100% + 48px + var(--lift, 0px)); display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; width: max-content; max-width: min(640px, 86vw);
  border-radius: var(--radius-btn); background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-deep); pointer-events: auto; }
.img-frame.bar-below .img-bar { bottom: auto; top: calc(100% + 52px + var(--lift, 0px)); }
.img-frame.bar-right .img-bar { left: auto; right: 0; }
.img-bar button { display: inline-grid; place-items: center; min-width: 30px; height: 28px; padding: 0 8px; border: 0; border-radius: 4px; background: transparent; color: inherit; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.img-bar button:hover { background: color-mix(in srgb, var(--on-ink) 14%, transparent); }
.img-bar button[aria-pressed="true"] { background: var(--on-ink); color: var(--ink); }
.img-bar .sep { width: 1px; height: 18px; margin: 0 4px; background: color-mix(in srgb, var(--on-ink) 30%, transparent); }
.img-size { padding: 0 8px 0 4px; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .7; }
#notesBody img { cursor: zoom-in; }
.prose blockquote { margin: 0 0 .6em; padding: 4px 0 4px 14px; border-left: 3px solid var(--ink); color: var(--ink-3); }

/* tags */
.tag-entry {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow-chip);
  border: 1px solid transparent;
}
.tag-entry:focus-within { border-color: var(--ink); }
.tag-entry input { flex: 1 1 120px; border: 0; outline: none; background: transparent; padding: 4px; min-width: 0; }

/* screenshots: every image is shown in the same 16:10 frame */
.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  display: grid;
  gap: 6px;
  justify-items: center;
  cursor: pointer;
  background: var(--card);
}
.dropzone strong { color: var(--ink); }
.dropzone.over { border-color: var(--ink); background: var(--paper-lo); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.shots:empty { display: none; }
.shot { position: relative; border-radius: 8px; overflow: hidden; background: var(--night-2); aspect-ratio: 16 / 10; max-width: 100%; }
.shot img { width: 100%; height: 100%; object-fit: contain; display: block; }
.shot button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--ink);
  display: grid;
  place-items: center;
}
.shot .new { position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; background: var(--card); padding: 2px 6px; border-radius: 3px; }

/* confirm */
.confirm { width: 420px; max-width: 100%; background: var(--paper-hi); border-radius: var(--radius-lg); padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow-deep); }
.confirm h2 { font-size: 26px; letter-spacing: -0.03em; }
.confirm p { margin: 0; color: var(--ink-3); }
.confirm .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* screenshot viewer */
.viewer { display: grid; gap: 12px; justify-items: center; }
.viewer img {
  width: min(1200px, calc(100vw - 32px));
  aspect-ratio: 16 / 10;
  max-height: calc(100vh - 130px);
  object-fit: contain;
  border-radius: 10px;
  background: var(--night-2);
  box-shadow: var(--shadow-deep);
}
.viewer-bar { display: flex; gap: 10px; align-items: center; color: var(--night-fg); font-size: 14px; max-width: 80ch; text-align: center; }
.viewer-bar .icon-btn { flex: 0 0 auto; }

/* notes reader */
.reader { width: 720px; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--paper-hi); border-radius: var(--radius-lg); box-shadow: var(--shadow-deep); }
.reader-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 28px; background: var(--grad-night); color: var(--night-fg); }
.reader-head .eyebrow { color: var(--night-muted); }
.reader-head h2 { font-size: 24px; letter-spacing: -0.03em; margin-top: 4px; }
.reader .prose { padding: 24px 28px 32px; font-size: 15px; line-height: 1.65; }

/* side drawer (journal filters) */
dialog.drawer {
  margin: 0 0 0 auto;
  height: 100vh;
  max-height: 100vh;
  max-width: 100vw;
}
.drawer-panel {
  width: 380px;
  max-width: 100vw;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper-hi);
  box-shadow: var(--shadow-deep);
}
@media (prefers-reduced-motion: no-preference) {
  dialog.drawer[open] > .drawer-panel { animation: slide 320ms var(--ease-drawer); }
  @keyframes slide { from { transform: translateX(100%); } to { transform: none; } }
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 24px 22px;
  background: var(--grad-night);
  color: var(--night-fg);
}
.drawer-head h2 { font-size: 24px; letter-spacing: -0.03em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px; display: grid; gap: 16px; align-content: start; }
.drawer-foot { display: flex; gap: 8px; justify-content: space-between; padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.drawer-foot .btn-ink { flex: 1; }
.pair-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drawer .popover { width: 290px; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--grad-ink);
  color: var(--on-ink);
  font-weight: 500;
  box-shadow: var(--shadow-button);
}
.toast.error { background: var(--loss); color: #FFFFFF; }

/* Strategy checklist in the trade form: ticked items make the valid setup % and grade. */
.setup-check { display: grid; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--paper-hi); }
.setup-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.setup-items .check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.setup-items input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.setup-items .weight { margin-left: auto; padding: 1px 7px; border-radius: 999px; background: var(--paper-lo); color: var(--ink-2); font-size: 11px; font-weight: 600; white-space: nowrap; }
.setup-score { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.form-notes .hint a { color: var(--ink); font-weight: 600; }
/* Site-styled dropdowns (js/select.js): the native select is hidden and a button with a listbox stands in for it. */
.select { position: relative; min-width: 0; }
.select-native { position: absolute; inset: auto auto 0 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.select-button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; cursor: pointer; }
.select-button.input { background-image: none; padding-right: 14px; }
.select-button .select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-button.placeholder .select-value { color: var(--muted); }
.select-button svg { flex: none; color: var(--ink-3); transition: transform .2s ease; }
.select.open .select-button { border-color: var(--ink); }
.select.open .select-button svg { transform: rotate(180deg); }
.select-button:disabled { cursor: default; opacity: .6; }
.select.compact .select-button { width: auto; height: 32px; gap: 6px; }
.select-pop { width: auto; max-width: min(440px, calc(100vw - 32px)); padding: 6px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; color: var(--ink); }
/* In narrow places (the sidebar) the list is exactly as wide as its field. */
.sidebar .select-pop { width: 100%; min-width: 0 !important; max-width: 100%; }
.select-search { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--paper-hi); font-size: 14px; }
.select-search:focus { outline: none; border-color: var(--ink); }
.select-list { display: grid; grid-template-columns: minmax(0, 1fr); max-height: 300px; overflow-y: auto; overflow-x: hidden; }
.select-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 9px 10px;
  font-size: 14px;
  text-align: left;
  color: var(--ink);
  min-width: 0;
}
/* Long names wrap onto a second line instead of widening the list. */
.select-opt span { min-width: 0; overflow-wrap: anywhere; }
.select-opt svg { flex: none; }
.select-opt:hover, .select-opt:focus-visible { background: var(--paper-lo); outline: none; }
.select-opt.on { font-weight: 600; }
.select-opt:disabled { color: var(--faint); }
.select-group { padding: 10px 10px 4px; font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.select-empty { padding: 10px; font-size: 13px; color: var(--muted); }

/* Checkboxes and radio buttons in the Margin style: ink on paper, in every theme. */
input[type="checkbox"], input[type="radio"] {
  appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--ink-3);
  border-radius: 5px;
  background: var(--card);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
input[type="radio"] { border-radius: 50%; }
/* A checkbox with its sentence (sign-up consents, Settings → Emails). */
.check-line { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; line-height: 1.45; }
.check-line input { flex: none; margin-top: 1px; }
input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--card);
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 38% 72%);
  transform: scale(0);
  transition: transform .15s ease;
}
input[type="radio"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--card); transform: scale(0); transition: transform .15s ease; }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--ink); border-color: var(--ink); }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
/* Half-ticked ("some of these"): a dash instead of the tick. */
input[type="checkbox"]:indeterminate { background: var(--ink); border-color: var(--ink); }
input[type="checkbox"]:indeterminate::before { clip-path: inset(40% 10%); transform: scale(1); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .5; cursor: default; }

/* Number fields without the browser's spin buttons; search fields without its clear icon. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }