/* NextBatch Mini Apps — dark-only, Frost aurora + glass surfaces */

:root {
  /* Soft-keyboard height, set from visualViewport while typing Entry/SL. */
  --kb: 0px;
  --background: 240 6% 4%;
  --foreground: 0 0% 98%;
  --card: 0 0% 0%;
  --card-foreground: 0 0% 98%;
  --popover: 240 6% 6%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 6% 4%;
  --secondary: 240 4% 16%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 4% 16%;
  --muted-foreground: 0 0% 63%;
  --accent: 0 0% 100% / 0.08;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 72% 55%;
  --destructive-foreground: 0 0% 98%;
  --border: 0 0% 100% / 0.08;
  --input: 0 0% 100% / 0.1;
  --ring: 0 0% 100% / 0.18;
  --radius: 0.5rem;
  --radius-sm: calc(var(--radius) - 2px);
  --success: 160 84% 52%;
  --success-fg: 160 86% 6%;
  --warn-text: 0 90% 76%;
  --warn-bg: 0 45% 12%;
  --warn-border: 0 45% 24%;
  --gap: 12px;
  --input-h: 36px;
  --signal-panel-w: 400px;

  /* Glass surface tokens (matches Dashboard defaults) */
  --surface-tint: 0, 0, 0;
  --surface-opacity: 0.6;
  --surface-border-opacity: 0.1;
  --surface-shadow-opacity: 0.5;
  --surface-radius: 16px;
  --surface-bg: rgba(var(--surface-tint), var(--surface-opacity));
  --surface-border: rgba(255, 255, 255, var(--surface-border-opacity));
  --surface-shadow: 0 4px 24px -8px rgba(0, 0, 0, var(--surface-shadow-opacity));
  --surface-soft: rgba(255, 255, 255, 0.05);
  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.18);
  --text-subtle: rgba(250, 250, 250, 0.4);
  --text-faint: rgba(250, 250, 250, 0.22);
  --nested-radius: 12px;
  --card-pad: 18px;
  --card-gap: 16px;
  --section-gap: 20px;

  /* Frost aurora — winter preset from NextBatch Dashboard */
  --app-aurora-base: #06090e;
  --app-aurora:
    radial-gradient(ellipse 130% 95% at 30% -15%, rgba(125, 211, 252, 0.500) 0%, rgba(125, 211, 252, 0.390) 10%, rgba(125, 211, 252, 0.280) 22%, rgba(125, 211, 252, 0.190) 36%, rgba(125, 211, 252, 0.115) 52%, rgba(125, 211, 252, 0.060) 68%, rgba(125, 211, 252, 0.020) 84%, rgba(125, 211, 252, 0.000) 100%),
    radial-gradient(ellipse 110% 85% at 115% 55%, rgba(94, 234, 212, 0.380) 0%, rgba(94, 234, 212, 0.296) 10%, rgba(94, 234, 212, 0.213) 22%, rgba(94, 234, 212, 0.144) 36%, rgba(94, 234, 212, 0.087) 52%, rgba(94, 234, 212, 0.046) 68%, rgba(94, 234, 212, 0.015) 84%, rgba(94, 234, 212, 0.000) 100%),
    radial-gradient(ellipse 115% 85% at -15% 95%, rgba(165, 243, 252, 0.280) 0%, rgba(165, 243, 252, 0.218) 10%, rgba(165, 243, 252, 0.157) 22%, rgba(165, 243, 252, 0.106) 36%, rgba(165, 243, 252, 0.064) 52%, rgba(165, 243, 252, 0.034) 68%, rgba(165, 243, 252, 0.011) 84%, rgba(165, 243, 252, 0.000) 100%),
    radial-gradient(ellipse 130% 60% at 50% 125%, rgba(0, 0, 0, 0.500) 0%, rgba(0, 0, 0, 0.390) 10%, rgba(0, 0, 0, 0.280) 22%, rgba(0, 0, 0, 0.190) 36%, rgba(0, 0, 0, 0.115) 52%, rgba(0, 0, 0, 0.060) 68%, rgba(0, 0, 0, 0.020) 84%, rgba(0, 0, 0, 0.000) 100%),
    linear-gradient(rgb(6, 9, 14), rgb(6, 9, 14));

  /* Ember aurora — loss recap / batch summary */
  --app-aurora-loss-base: #0e0608;
  --app-aurora-loss:
    radial-gradient(ellipse 130% 95% at 30% -15%, rgba(227, 133, 133, 0.480) 0%, rgba(227, 133, 133, 0.374) 10%, rgba(227, 133, 133, 0.269) 22%, rgba(227, 133, 133, 0.182) 36%, rgba(227, 133, 133, 0.110) 52%, rgba(227, 133, 133, 0.058) 68%, rgba(227, 133, 133, 0.019) 84%, rgba(227, 133, 133, 0.000) 100%),
    radial-gradient(ellipse 110% 85% at 115% 55%, rgba(248, 113, 113, 0.360) 0%, rgba(248, 113, 113, 0.281) 10%, rgba(248, 113, 113, 0.202) 22%, rgba(248, 113, 113, 0.137) 36%, rgba(248, 113, 113, 0.083) 52%, rgba(248, 113, 113, 0.044) 68%, rgba(248, 113, 113, 0.014) 84%, rgba(248, 113, 113, 0.000) 100%),
    radial-gradient(ellipse 115% 85% at -15% 95%, rgba(190, 90, 90, 0.260) 0%, rgba(190, 90, 90, 0.203) 10%, rgba(190, 90, 90, 0.146) 22%, rgba(190, 90, 90, 0.099) 36%, rgba(190, 90, 90, 0.060) 52%, rgba(190, 90, 90, 0.032) 68%, rgba(190, 90, 90, 0.010) 84%, rgba(190, 90, 90, 0.000) 100%),
    radial-gradient(ellipse 130% 60% at 50% 125%, rgba(0, 0, 0, 0.500) 0%, rgba(0, 0, 0, 0.390) 10%, rgba(0, 0, 0, 0.280) 22%, rgba(0, 0, 0, 0.190) 36%, rgba(0, 0, 0, 0.115) 52%, rgba(0, 0, 0, 0.060) 68%, rgba(0, 0, 0, 0.020) 84%, rgba(0, 0, 0, 0.000) 100%),
    linear-gradient(rgb(14, 6, 8), rgb(14, 6, 8));
}

html.aurora-loss {
  --app-aurora-base: var(--app-aurora-loss-base);
  --app-aurora: var(--app-aurora-loss);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  color-scheme: dark;
  background-color: var(--app-aurora-base);
}

body {
  font-family: "Inter var", Inter, ui-sans-serif, system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01";
  font-size: 14px;
  line-height: 1.5;
  color: hsl(var(--foreground));
  background-color: var(--app-aurora-base);
  background-image: var(--app-aurora);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Hide native number spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

::selection { background: hsl(var(--foreground) / 0.12); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 99px; }

/* Quiet mobile tap flashes; consistent keyboard focus everywhere. */
button, .input { -webkit-tap-highlight-color: transparent; }
.btn:focus-visible, .toggle-item:focus-visible, .chip:focus-visible,
.num-item:focus-visible, .buffer-step:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid hsl(var(--ring) / 0.55);
  outline-offset: 1px;
}

/* Page heading used by the journal/settings Mini Apps. */
.page-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

input[type="number"], .stat-chip, .tp-result { font-variant-numeric: tabular-nums; }

/* ── Header ── */
.header {
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  position: sticky; top: 0; z-index: 40;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 28px; height: 28px; border-radius: 6px;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-size: 13px; font-weight: 700;
  display: grid; place-items: center;
}
.header-title { font-size: 14px; font-weight: 600; letter-spacing: -0.02em; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-pip .select-trigger {
  height: 28px;
  font-size: 13px;
  padding: 0 10px;
}

/* ── Layout ── */
.main {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  display: flex; flex-direction: column; gap: var(--section-gap, 18px);
}

@media (min-width: 900px) {
  .main {
    max-width: 720px;
    padding: 24px 20px 32px;
    gap: 22px;
  }
}

/* ── Card — glass surface (Dashboard style) ── */
.card {
  position: relative;
  overflow: hidden;
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: var(--card-pad, 16px);
  box-shadow: 0 1px 2px hsl(240 6% 10% / 0.04), 0 1px 3px hsl(240 6% 10% / 0.06);
  display: flex; flex-direction: column; gap: var(--card-gap, var(--gap));
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.card {
  border-radius: var(--surface-radius);
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 1px rgba(255, 255, 255, 0.015),
    var(--surface-shadow);
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(255, 255, 255, 0.18) 50%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 2;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.card > .lbl-row {
  margin-bottom: 2px;
}
.card-flat { padding: 12px 16px; }

/* Nested tiles (only where explicitly needed — not summary/recap stat grids) */
.nested-card {
  position: relative;
  border-radius: var(--nested-radius, 12px);
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: none;
  overflow: visible;
}
.card .nested-card::before {
  display: none;
}

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }

/* Journal yes/no pairs: toggles align on one row; stack when too narrow */
.journal-pair {
  align-items: end;
}
.journal-pair .field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.journal-pair .lbl {
  min-height: 2.75em;
  margin-bottom: 6px;
  line-height: 1.35;
}
@media (max-width: 420px) {
  .journal-pair {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .journal-pair .lbl {
    min-height: 0;
  }
}

/* ── Form ── */
.field { min-width: 0; }
.lbl {
  display: block; font-size: 13px; font-weight: 500;
  margin-bottom: 6px; line-height: 1;
}
.lbl-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.lbl-row .lbl { margin: 0; }
.dim { color: hsl(var(--muted-foreground)); font-weight: 400; font-size: 12px; }
.hint { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 6px; }
.hidden { display: none !important; }

/* ── Stat chip ── */
.stat-chip {
  height: var(--input-h);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px;
  color: hsl(var(--foreground));
  font-weight: 500;
}

.chip {
  background: transparent; border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground)); font-family: inherit; font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 4px; cursor: pointer;
}
.chip:hover { color: hsl(var(--foreground)); border-color: hsl(var(--ring)); }

/* ── Inputs ── */
.input {
  display: flex; width: 100%; height: var(--input-h);
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  padding: 0 12px;
  font-size: 14px; font-family: inherit; color: hsl(var(--foreground));
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.input {
  background: var(--surface-soft);
  border-color: var(--surface-border);
}
.input::placeholder { color: hsl(var(--muted-foreground)); opacity: 0.45; }
.input:focus-visible {
  outline: none;
  border-color: hsl(var(--foreground) / 0.4);
  box-shadow: none;
}
.textarea { height: auto; min-height: 60px; padding: 10px 12px; resize: none; }

/* ── Toggle group (shadcn) ── */
.toggle-group {
  display: flex; gap: 2px;
  background: hsl(var(--muted) / 0.8);
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: var(--radius-sm);
  padding: 3px; width: 100%;
}
.toggle-group {
  background: var(--surface-soft);
  border-color: var(--surface-border);
}
.toggle-xs .toggle-item { padding: 4px 10px; font-size: 12px; }
.toggle-item {
  flex: 1; border: none; border-radius: calc(var(--radius-sm) - 2px);
  background: transparent; color: hsl(var(--muted-foreground));
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 12px; cursor: pointer;
  transition: all 0.15s;
}
.toggle-item:hover { color: hsl(var(--foreground)); }
.toggle-item:active { transform: scale(0.98); }
.toggle-item.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-weight: 600;
  box-shadow: 0 1px 2px hsl(0 0% 0% / 0.2);
}
.toggle-item.active {
  background: var(--surface-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.toggle-item.buy.active { color: hsl(var(--success)); }
.toggle-item.sell.active { color: hsl(var(--destructive)); }

/* ── Buttons (shadcn) ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--input-h); padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border: none;
}
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
}
.btn-icon:hover { background: hsl(var(--accent)); }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-primary:hover { opacity: 0.9; }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-ghost {
  background: transparent; color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
}
.btn-ghost:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.btn-full { width: 100%; margin-top: 4px; }

/* ── Icon button (chart settings etc.) ── */
.chart-label { display: flex; align-items: center; gap: 8px; }
.chart-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: hsl(var(--accent)); border-color: hsl(var(--ring)); }
.icon-btn svg { width: 16px; height: 16px; }

/* ── Select / Combobox (from ui.js) ── */
.select, .combobox { position: relative; }
.select-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; height: var(--input-h);
  padding: 0 12px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius-sm);
  color: hsl(var(--foreground)); font-size: 14px; font-family: inherit;
  cursor: pointer; text-align: left;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.select-trigger {
  background: var(--surface-soft);
  border-color: var(--surface-border);
}
.select-trigger:hover { background: hsl(var(--accent)); }
.select-trigger:focus-visible {
  outline: none;
  border-color: hsl(var(--foreground) / 0.4);
  box-shadow: none;
}
.select-icon { opacity: 0.5; display: flex; }
.combobox-wrap { position: relative; display: flex; }
.combobox-input { padding-right: 36px; }
.combobox-trigger {
  position: absolute; right: 0; top: 0; bottom: 0; width: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: hsl(var(--muted-foreground)); opacity: 0.5;
}
.combobox-trigger:hover { opacity: 1; }
.popover { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50; }
.popover.open { display: block; }
.popover-content {
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 10px 15px -3px rgb(0 0 0 / 0.15);
  max-height: 240px; overflow-y: auto;
}
.popover-content {
  background: rgba(0, 0, 0, 0.82);
  border-color: var(--surface-border);
  box-shadow: var(--surface-shadow);
}
.popover-empty { padding: 20px 12px; text-align: center; font-size: 13px; color: hsl(var(--muted-foreground)); }
.select-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px; border: none; border-radius: calc(var(--radius-sm) - 2px);
  background: transparent; color: hsl(var(--foreground));
  font-size: 14px; font-family: inherit; text-align: left; cursor: pointer;
}
.select-item:hover, .select-item:focus-visible { background: hsl(var(--accent)); outline: none; }
.select-item-check { width: 16px; opacity: 0; flex-shrink: 0; }
.select-item.selected .select-item-check { opacity: 1; }
.select-item.selected { font-weight: 500; }

/* ── Stop loss (single row) ── */
.sl-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sl-row .lbl { margin: 0; flex-shrink: 0; }
.sl-toggle { width: auto; flex-shrink: 0; }
.sl-input-wrap { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.sl-input-wrap .input { width: 100%; }
#slPipsWrap .input { padding-right: 44px; }
.sl-suffix {
  position: absolute; right: 12px;
  font-size: 13px; color: hsl(var(--muted-foreground));
  pointer-events: none;
}
.sl-price-preview {
  position: absolute; right: 46px;
  font-size: 12px; color: hsl(var(--muted-foreground));
  opacity: 0.6; pointer-events: none; white-space: nowrap;
  display: none;
}

/* ── TP block (merged into Entry/SL card) ── */
.tp-block {
  display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid hsl(var(--border));
  padding-top: var(--gap);
}

/* ── TP list ── */
.tp-list { display: flex; flex-direction: column; gap: 8px; }
.tp-row {
  display: grid;
  grid-template-columns: 32px 1fr auto 28px;
  align-items: center; gap: 8px;
}
.tp-tag { font-size: 12px; font-weight: 600; color: hsl(var(--muted-foreground)); font-family: inherit; text-align: right; }
.tp-row .input { height: 32px; font-size: 13px; }
.tp-result { font-size: 12px; font-family: inherit; color: hsl(var(--success)); text-align: right; min-width: 90px; font-weight: 500; }
.tp-del {
  width: 28px; height: 28px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: hsl(var(--muted-foreground)); font-size: 18px; cursor: pointer;
  display: grid; place-items: center;
}
.tp-del:hover { background: hsl(var(--accent)); color: hsl(var(--destructive)); }

/* ── Preview ── */
.preview {
  background: hsl(var(--muted) / 0.5);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: inherit; font-size: 13px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word;
  color: hsl(var(--foreground));
  min-height: 140px;
}
.preview {
  background: var(--surface-soft);
  border-color: var(--surface-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.warn-item {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 500;
  color: hsl(var(--warn-text));
  background: hsl(var(--warn-bg));
  border: 1px solid hsl(var(--warn-border));
}

/* ── Presets ── */
.preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
  max-height: 160px;
  overflow-y: auto;
}
.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  background: hsl(var(--background));
  cursor: pointer;
}
.preset-item {
  background: var(--surface-soft);
  border-color: var(--surface-border);
}
.preset-item:hover {
  background: hsl(var(--accent));
}
.preset-item.active {
  border-color: hsl(var(--foreground) / 0.35);
}
.preset-name {
  font-size: 13px;
  font-weight: 500;
}
.preset-meta {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(76px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: all .2s;
  box-shadow: 0 10px 25px rgb(0 0 0 / 0.2); z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.app-disclaimer {
  font-size: 11px;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
  text-align: center;
  margin: 18px auto 0;
  padding: 0 14px;
  max-width: 520px;
  opacity: 0.8;
}

/* Keeps the last card clear of the floating action dock. */
.bottom-spacer {
  height: calc(84px + env(safe-area-inset-bottom));
}

/* ── Floating action dock ── */
.action-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom));
  background: transparent;
  border: none;
  pointer-events: none;
}
.action-bar-inner {
  max-width: 520px;
  margin: 0 auto;
  pointer-events: auto;
  display: flex;
  gap: 8px;
  padding: 6px;
  background: hsl(var(--card) / 0.96);
  border: 1px solid hsl(var(--border));
  border-radius: 16px;
  box-shadow:
    0 4px 6px hsl(0 0% 0% / 0.06),
    0 16px 40px hsl(0 0% 0% / 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.action-bar-inner {
  background: rgba(0, 0, 0, 0.72);
  border-color: var(--surface-border);
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 1px rgba(255, 255, 255, 0.015),
    var(--surface-shadow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.btn-action {
  flex: 1;
  height: 46px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 11px;
  border: none;
}
.action-bar .btn-ghost {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border: none;
}
.action-bar .btn-ghost:hover { background: hsl(var(--accent)); }
.action-bar .btn-ghost {
  background: var(--surface);
}
.action-bar .btn-ghost:hover { background: var(--surface-strong); }
.action-bar .btn-primary {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}
.action-bar .btn-primary:hover { opacity: 0.92; }
.action-bar .btn-primary {
  background: hsl(0 0% 88%);
  color: hsl(240 6% 7%);
}
/* Valid signal: the action button takes the direction color (buy/sell).
   Both rules carry the dark-theme variant so they outrank the override above. */
.action-bar .btn-primary.btn-buy,
.action-bar .btn-primary.btn-buy {
  background: hsl(var(--success));
  color: hsl(var(--success-fg));
}
.action-bar .btn-primary.btn-sell,
.action-bar .btn-primary.btn-sell {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

/* Confirm & Send button inside the confirm sheet: full width, same weight as
   the bottom action dock button (the .btn-action flex sizing only works inside
   the horizontal dock, so the sheet button gets its own explicit sizing). */
#confirmSendBtn {
  width: 100%;
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}
#confirmSendBtn:hover { opacity: 0.92; }
#confirmSendBtn {
  background: hsl(0 0% 88%);
  color: hsl(240 6% 7%);
}
#confirmSendBtn.btn-buy,
#confirmSendBtn.btn-buy {
  background: hsl(var(--success));
  color: hsl(var(--success-fg));
}
#confirmSendBtn.btn-sell,
#confirmSendBtn.btn-sell {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

/* Update accounts button in the confirm sheet: full-width, same size as an
   account row, so a freshly started account is one tap away. */
#refreshAccountsBtn { width: 100%; margin-top: 6px; }

/* ── Preview sheet (bottom sheet) ── */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}
.sheet.open { display: block; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  animation: sheet-fade 0.18s ease;
}
.sheet-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: hsl(var(--background));
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  border-top: 1px solid hsl(var(--border));
  box-shadow: 0 -10px 30px hsl(0 0% 0% / 0.4);
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  max-width: 520px;
  margin: 0 auto;
  max-height: 85vh;
  animation: sheet-up 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet-panel {
  background: rgba(0, 0, 0, 0.88);
  border-top-color: var(--surface-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 -16px 48px rgba(0, 0, 0, 0.55);
}
.sheet-handle {
  width: 36px; height: 4px;
  border-radius: 99px;
  background: hsl(var(--border));
  margin: 4px auto 2px;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
}
.sheet-close {
  width: 30px; height: 30px;
  border: none; border-radius: var(--radius-sm);
  background: transparent; color: hsl(var(--muted-foreground));
  font-size: 15px; cursor: pointer;
  display: grid; place-items: center;
}
.sheet-close:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.sheet-panel .preview { flex: 1; overflow-y: auto; }

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes sheet-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 900px) {
  .action-bar-inner { max-width: 720px; }
}

/* ── TradingView chart ── */
.tv-chart {
  position: relative;
  width: 100%;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: hsl(var(--card));
  transition: height 0.2s ease;
}
.tv-chart {
  background: rgba(0, 0, 0, 0.45);
  border-color: var(--surface-border);
}
.tv-chart--large { height: 440px; }
.tv-chart--full {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  border: none;
  border-radius: 0;
  z-index: 1000;
}
.tv-fullscreen-header {
  display: none;
}
.tv-close {
  display: none;
}

@media (max-width: 899px) {
  .tv-chart--full .tv-fullscreen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 46px;
    padding: 0 16px;
    background: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--border));
  }
  .tv-chart--full .tv-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-sm);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
  }
  .tv-chart--full .tv-close:hover {
    background: hsl(var(--accent));
    border-color: hsl(var(--ring));
  }
  .tv-chart--full .tv-fullscreen-title {
    font-size: 14px;
    font-weight: 600;
    color: hsl(var(--foreground));
  }
  .tv-chart--full .tradingview-widget-container {
    height: calc(100% - 46px) !important;
  }
}

/* ── Signal side panel (desktop fullscreen) ── */
.signal-panel-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid hsl(var(--border));
}

.desktop-preview-wrap {
  display: none;
}

@media (min-width: 900px) {
  .desktop-preview-wrap {
    display: block;
    margin-top: 16px;
    border-top: 1px solid hsl(var(--border));
    padding-top: 16px;
  }
  .desktop-preview-wrap .lbl {
    margin-bottom: 8px;
  }
  body.desktop-chart-full .tv-chart--full {
    top: 0;
    left: 0;
    bottom: 0;
    right: var(--signal-panel-w);
    width: auto;
    height: 100dvh;
  }
  body.desktop-chart-full .signal-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--signal-panel-w);
    height: 100dvh;
    z-index: 1001;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    border: none;
    border-left: 1px solid var(--surface-border, hsl(var(--border)));
    border-radius: 0;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
    background: var(--surface-bg, hsl(var(--card)));
    padding: 16px;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }
  body.desktop-chart-full .signal-panel-head {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 2;
    background: inherit;
    padding-top: 4px;
    margin: -4px 0 0;
  }
  body.desktop-chart-full .main > .card:first-child .lbl-row {
    display: none;
  }
  body.desktop-chart-full .main > .card-flat,
  body.desktop-chart-full .bottom-spacer {
    display: none;
  }
  body.desktop-chart-full .action-bar {
    left: auto;
    right: 0;
    width: var(--signal-panel-w);
    padding: 0;
    border-top: 1px solid var(--surface-border, hsl(var(--border)));
    background: var(--surface-bg, hsl(var(--card)));
    z-index: 1002;
  }
  body.desktop-chart-full .action-bar-inner {
    max-width: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 12px 16px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  body.desktop-chart-full .toast {
    right: calc(var(--signal-panel-w) / 2);
    left: auto;
    transform: translateX(50%) translateY(8px);
  }
  body.desktop-chart-full .toast.show {
    transform: translateX(50%) translateY(0);
  }
}

.tv-chart .tradingview-widget-copyright {
  height: 28px;
  line-height: 28px;
  text-align: center;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}
.tv-chart .tradingview-widget-copyright a,
.tv-chart .tradingview-widget-copyright .blue-text {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
}
.tv-chart .tradingview-widget-copyright a:hover .blue-text { color: hsl(var(--foreground)); }

/* ── Generic fold-out (Footer / Presets) ── */
.foldout { padding: 0; gap: 0; }
.foldout > .foldout-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  user-select: none;
}
.foldout > .foldout-summary > .lbl { margin: 0; }
.foldout > .foldout-summary > .dim { margin-right: auto; }
.foldout > .foldout-summary::-webkit-details-marker { display: none; }
.foldout > .foldout-summary::marker { content: ""; }
.foldout > .foldout-summary::after {
  content: "";
  width: 7px; height: 7px;
  border-right: 1.5px solid hsl(var(--muted-foreground));
  border-bottom: 1.5px solid hsl(var(--muted-foreground));
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.foldout[open] > .foldout-summary::after { transform: rotate(45deg); }
.foldout[open] > .foldout-summary { border-bottom: 1px solid hsl(var(--border)); }
.foldout-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}
.preset-select .select-trigger { height: 44px; font-size: 15px; }

/* ── Advanced fold-out ── */
.advanced { padding: 0; gap: 0; }
.advanced > .advanced-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  user-select: none;
}
.advanced > .advanced-summary::-webkit-details-marker { display: none; }
.advanced > .advanced-summary::marker { content: ""; }
.advanced[open] > .advanced-summary { border-bottom: 1px solid hsl(var(--border)); }
.advanced-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

/* ── Mobile: padded glass cards over aurora background ── */
@media (max-width: 640px) {
  .main {
    padding: max(12px, env(safe-area-inset-top)) 12px 12px;
    gap: 16px;
  }
  .main > .card:first-child {
    padding-top: 14px;
  }
  .main > .card:first-child .lbl-row {
    margin-bottom: 8px;
    padding-left: 0;
    padding-right: 0;
  }
  .card .tv-chart--large {
    width: 100%;
    border-radius: calc(var(--surface-radius, var(--radius)) - 4px);
  }
  .card .tv-chart--large {
    border-radius: 10px;
  }
  .bottom-spacer {
    height: calc(96px + env(safe-area-inset-bottom));
  }
  .action-bar {
    padding-left: 10px;
    padding-right: 10px;
  }
  .toast {
    bottom: calc(82px + env(safe-area-inset-bottom));
  }
}

/* ── Journal Mini App ── */
/* minmax(0, 1fr) keeps the tracks from forcing the card wider than the
   viewport (which would clip the last column and kill the card padding). */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
@media (min-width: 380px) {
  .chip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 560px) {
  .chip-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 8px 10px; cursor: pointer;
  transition: all 0.15s;
}
.chip {
  background: var(--surface-soft);
  border-color: var(--surface-border);
}
.chip:hover { color: hsl(var(--foreground)); border-color: hsl(var(--ring)); }
.chip:active { transform: scale(0.98); }
.chip.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
  font-weight: 600;
}
.chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.chip:disabled:hover { color: hsl(var(--muted-foreground)); border-color: hsl(var(--input)); }
.num-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
}
.num-item {
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 0; cursor: pointer; text-align: center;
  transition: all 0.15s;
}
.num-item {
  background: var(--surface-soft);
  border-color: var(--surface-border);
}
.num-item:hover { color: hsl(var(--foreground)); border-color: hsl(var(--ring)); }
.num-item:active { transform: scale(0.96); }
.num-item.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}
@media (max-width: 360px) {
  .num-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.layer-count-wrap {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 10px;
}

/* ── Settings Mini App ── */
.chip-dot { font-size: 8px; line-height: 1; color: hsl(var(--success)); }
.chip-dot.off { color: hsl(var(--destructive) / 0.8); }
.chip-dirty { font-size: 16px; line-height: 1; color: hsl(var(--destructive)); font-weight: 700; }

/* Account switcher: full-width rows so long broker names never wrap or
   squash; label truncates, status dot stays pinned right. */
#accountGrid { grid-template-columns: 1fr; }
@media (min-width: 560px) {
  #accountGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
#accountGrid .chip { justify-content: space-between; text-align: left; }
#accountGrid .chip-label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Confirm sheet account chooser: full-width rows like the settings switcher so
   long broker names never clip; label truncates, status dot pinned right. */
#confirmAccountGrid { grid-template-columns: 1fr; }
#confirmAccountGrid .chip { justify-content: space-between; text-align: left; }
#confirmAccountGrid .chip-label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Save button: fixed main line plus truncating account subline, so long
   account labels never blow up the button. */
#saveBtn {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px; min-width: 0;
}
.btn-stack-main { line-height: 1.2; }
.btn-stack-sub {
  font-size: 11px; font-weight: 500; opacity: 0.7; line-height: 1.2;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Buffer zone stepper: one composed control instead of loose boxes. */
.buffer-group {
  display: flex; align-items: stretch;
  height: 40px;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius-sm);
  background: hsl(var(--background));
  overflow: hidden;
}
.buffer-group {
  background: var(--surface-soft);
  border-color: var(--surface-border);
}
.buffer-group > * + * { border-left: 1px solid hsl(var(--border)); }
.buffer-step {
  flex: 0 0 46px;
  border: none; background: transparent;
  color: hsl(var(--muted-foreground));
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.buffer-step:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.buffer-step:active { transform: scale(0.96); }
.buffer-input {
  flex: 1; min-width: 0;
  border: none; outline: none;
  background: transparent;
  text-align: center;
  font-family: inherit; font-size: 15px; font-weight: 600;
  color: hsl(var(--foreground));
}

/* Layers section is parked (not editable) while Prop Firm mode is active. */
.card.layers-off .field { opacity: 0.45; pointer-events: none; }

/* ── Summary Mini App ─────────────────────────────────────────────────── */
/* Trading-semantic colors matching the NextBatch Dashboard */
.page-summary { --nb-profit: #BAE6FD; --nb-loss: #E38585; --nb-profit-dim: rgba(186,230,253,0.12); --nb-loss-dim: rgba(227,133,133,0.12); }

.summary-page-header {
  text-align: center;
  padding: max(16px, env(safe-area-inset-top)) 16px 4px;
}
.summary-page-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: hsl(var(--foreground));
}
.summary-page-meta {
  margin: 6px 0 0;
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
}
.summary-section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 8px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.summary-section-divider::before,
.summary-section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: hsl(var(--border));
}
.summary-hero {
  text-align: center;
  padding: 12px 8px 8px;
}
.summary-hero-pnl {
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 0 0 14px;
}
.summary-hero-pnl.profit { color: var(--nb-profit, #BAE6FD); }
.summary-hero-pnl.loss { color: var(--nb-loss, #E38585); }
.summary-hero-pnl.neutral { color: hsl(var(--foreground)); }
.summary-hero-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 16px;
  border-radius: 99px;
  margin: 0 auto 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.summary-hero-sep {
  color: hsl(var(--muted-foreground) / 0.4);
}
.summary-hero-reason {
  font-size: 14px;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  margin-bottom: 6px;
}
.summary-hero-reason.profit { color: var(--nb-profit, #BAE6FD); }
.summary-hero-reason.loss { color: var(--nb-loss, #E38585); }
.summary-hero-time {
  font-size: 12px;
  font-weight: 500;
  color: hsl(var(--muted-foreground) / 0.6);
}
.summary-hero-pair {
  color: hsl(var(--foreground));
}
.summary-hero-pill .buy { color: var(--nb-profit, #BAE6FD); }
.summary-hero-pill .sell { color: var(--nb-loss, #E38585); }
.summary-hero-pill .profit { color: var(--nb-profit, #BAE6FD); }
.summary-hero-pill .loss { color: var(--nb-loss, #E38585); }
.num-animate {
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .summary-bar-fill { transition: none; }
}

.summary-metrics,
.recap-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
}
.summary-metric,
.recap-stat-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  min-width: 0;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: transparent;
}
.summary-metric:nth-child(3n),
.recap-stat-card:nth-child(3n) {
  border-right: none;
}
.summary-metric:nth-last-child(-n+3),
.recap-stat-card:nth-last-child(-n+3) {
  border-bottom: none;
}
@media (max-width: 539px) {
  .summary-metrics,
  .recap-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .summary-metric,
  .recap-stat-card {
    border-right: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
  }
  .summary-metric:nth-child(3n),
  .recap-stat-card:nth-child(3n) {
    border-right: 1px solid var(--hairline);
  }
  .summary-metric:nth-child(2n),
  .recap-stat-card:nth-child(2n) {
    border-right: none;
  }
  .summary-metric:nth-last-child(-n+3),
  .recap-stat-card:nth-last-child(-n+3) {
    border-bottom: 1px solid var(--hairline);
  }
  .summary-metric:nth-last-child(-n+2),
  .recap-stat-card:nth-last-child(-n+2) {
    border-bottom: none;
  }
}
.summary-metric-label,
.recap-stat-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.summary-metric-value,
.recap-stat-value {
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.summary-metric-value.profit,
.recap-stat-value.profit { color: var(--nb-profit, #BAE6FD); }
.summary-metric-value.loss,
.recap-stat-value.loss { color: var(--nb-loss, #E38585); }
.summary-metric-value.neutral { color: hsl(var(--foreground)); }

#metricsCard {
  gap: 10px;
}
#metricsCard > .lbl-row,
.card:has(.recap-stat-grid) > .lbl-row {
  margin-bottom: 0;
}

.summary-bar-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.summary-bar-row {}
.summary-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.summary-bar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}
.summary-bar-value {
  font-size: 12px;
  font-weight: 700;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}
.summary-bar-track {
  width: 100%;
  height: 8px;
  background: hsl(var(--muted) / 0.6);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid hsl(var(--border) / 0.5);
}
.summary-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  transition: width 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}
.summary-bar-fill.profit {
  background: linear-gradient(90deg, rgba(186,230,253,0.4), #BAE6FD);
}
.summary-bar-fill.loss {
  background: linear-gradient(90deg, rgba(227,133,133,0.4), #E38585);
}
.summary-bar-fill.neutral {
  background: linear-gradient(90deg, hsl(var(--muted-foreground) / 0.3), hsl(var(--muted-foreground)));
}
.summary-bar-sub {
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  margin-top: 4px;
}

.summary-tp-dots {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.summary-tp-dot {
  width: 20px;
  height: 6px;
  border-radius: 3px;
  background: hsl(var(--muted) / 0.5);
  border: 1px solid hsl(var(--border) / 0.4);
}
.summary-tp-dot.hit {
  background: #FFF9E5;
  border-color: rgba(255,249,229,0.5);
}

.summary-separator {
  height: 1px;
  background: hsl(var(--border));
  margin: 4px 0;
}

.summary-footer-account {
  display: block;
  text-align: center;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
  padding: 8px 0 0;
}

.summary-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}
.summary-detail-row + .summary-detail-row {
  border-top: 1px solid hsl(var(--border) / 0.5);
}
.summary-detail-label {
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}
.summary-detail-value {
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}

.page-recap .card > .lbl-row,
.page-summary .card > .lbl-row {
  margin-bottom: 10px;
}

.page-recap .card > .recap-tabs,
.page-summary .card > .summary-metrics,
.page-summary .card > .summary-bar-section {
  margin-top: 2px;
}

/* ── Recap Mini App ──────────────────────────────────────────────────── */
.page-recap { --nb-profit: #BAE6FD; --nb-loss: #E38585; --nb-profit-dim: rgba(186,230,253,0.12); --nb-loss-dim: rgba(227,133,133,0.12); }


.page-recap #dailyView,
.page-recap #weeklyView {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap, 16px);
}
.recap-tabs {
  display: flex;
  gap: 2px;
  background: hsl(var(--muted) / 0.8);
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.recap-tabs {
  background: var(--surface-soft);
  border-color: var(--surface-border);
}
.recap-tab {
  flex: 1;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.recap-tab:hover { color: hsl(var(--foreground)); }
.recap-tab.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-weight: 600;
  box-shadow: 0 1px 2px hsl(0 0% 0% / 0.15);
}
.recap-tab.active {
  background: var(--surface-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.recap-trade-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}
.recap-trade-row + .recap-trade-row {
  border-top: 1px solid hsl(var(--border) / 0.4);
}
.recap-trade-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.recap-trade-dot.win { background: var(--nb-profit, #BAE6FD); }
.recap-trade-dot.loss { background: var(--nb-loss, #E38585); }
.recap-trade-info {
  flex: 1;
  min-width: 0;
}
.recap-trade-symbol {
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
}
.recap-trade-time {
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}
.recap-trade-pnl {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.recap-trade-pnl.win { color: var(--nb-profit, #BAE6FD); }
.recap-trade-pnl.loss { color: var(--nb-loss, #E38585); }
.recap-trade-rr {
  font-size: 11px;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 48px;
}

.recap-chart {
  display: block;
  width: 100%;
  height: 168px;
  margin: 0;
}

.page-recap .recap-chart-card > .lbl-row {
  margin-bottom: 8px;
}

.recap-day-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}
.recap-day-row + .recap-day-row {
  border-top: 1px solid hsl(var(--border) / 0.4);
}
.recap-day-label {
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
  min-width: 36px;
}
.recap-day-bar-wrap {
  flex: 1;
  height: 6px;
  background: hsl(var(--muted) / 0.5);
  border-radius: 3px;
  overflow: hidden;
}
.recap-day-bar {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}
.recap-day-bar.profit { background: var(--nb-profit, #BAE6FD); }
.recap-day-bar.loss { background: var(--nb-loss, #E38585); }
.recap-day-pnl {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 70px;
  text-align: right;
}
.recap-day-trades {
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  min-width: 20px;
  text-align: right;
}

.recap-symbol-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 10px 0;
}
.recap-symbol-row + .recap-symbol-row {
  border-top: 1px solid hsl(var(--border) / 0.5);
}
.recap-symbol-name {
  font-size: 14px;
  font-weight: 700;
  color: hsl(var(--foreground));
}
.recap-symbol-meta {
  grid-column: 1;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
}
.recap-symbol-pnl {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  align-self: center;
}
.recap-symbol-pnl.win { color: var(--nb-profit, #BAE6FD); }
.recap-symbol-pnl.loss { color: var(--nb-loss, #E38585); }
.recap-empty {
  font-size: 13px;
  color: hsl(var(--muted-foreground));
  padding: 8px 0;
}

.summary-empty {
  text-align: center;
  padding: 40px 20px;
  color: hsl(var(--muted-foreground));
}
.summary-empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.summary-empty-text {
  font-size: 14px;
  font-weight: 500;
}

@media (max-width: 420px) {
  .summary-metric,
  .recap-stat-card { padding: 8px 9px; }
  .summary-metric-value,
  .recap-stat-value { font-size: 12px; }
  .summary-hero-pnl { font-size: 38px; }
  .summary-hero-pill { font-size: 12px; padding: 5px 12px; gap: 8px; }
}

/* Journal / settings: same padded glass cards on mobile as the signal app. */
@media (max-width: 640px) {
  .page-journal .main > .card:first-child,
  .page-summary .main > .card:first-child {
    padding-top: 14px;
  }
  .page-journal .main > .card:first-child .lbl-row,
  .page-summary .summary-page-header + .main > .card:first-child .lbl-row {
    padding-left: 0;
    padding-right: 0;
  }
}

/* ── Mobile capture mode (Entry/SL + chart pinned above keyboard) ──────────── */
@media (max-width: 899px) {
  :root {
    --capture-dock-h: 58px;
  }

  .capture-chrome {
    display: none;
    position: fixed;
    top: var(--vv-top, 0px);
    left: 0;
    right: 0;
    z-index: 80;
    max-width: 520px;
    margin: 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: calc(44px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
    background: rgba(6, 9, 14, 0.92);
    border-bottom: 1px solid var(--hairline);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  body.capture .capture-chrome { display: flex; }
  .capture-chrome-title {
    font-size: 13px;
    font-weight: 600;
    color: hsl(var(--foreground));
    letter-spacing: -0.01em;
  }
  .capture-done-btn {
    flex-shrink: 0;
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--hairline-strong);
    border-radius: 8px;
    background: var(--surface-strong);
    color: hsl(var(--foreground));
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .capture-done-btn:active { transform: scale(0.98); }

  body.capture {
    overflow: hidden;
    height: 100dvh;
  }

  /* Stack fills exactly the visible viewport (above the keyboard) */
  body.capture .main {
    position: fixed;
    left: 0;
    right: 0;
    max-width: 520px;
    margin: 0 auto;
    top: calc(var(--vv-top, 0px) + var(--capture-chrome-h, 44px));
    height: calc(
      var(--vv-height, 100dvh)
      - var(--capture-chrome-h, 44px)
      - var(--capture-dock-h, 58px)
      - 8px
    );
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    z-index: 70;
  }

  body.capture .card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }
  body.capture .card::before { display: none; }
  body.capture .main > .card + .card {
    border-top: 1px solid var(--hairline);
    margin-top: 0;
  }

  body.capture .capture-hide,
  body.capture .app-disclaimer,
  body.capture .bottom-spacer { display: none !important; }

  /* Chart grows in leftover space; inputs stay pinned below */
  body.capture .main > .card:first-child {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
  }
  body.capture .main > .card:first-child > .field {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    overflow: hidden;
  }
  body.capture .main > .card:first-child .lbl-row { display: none; }
  body.capture #tvChartWrap {
    flex: 1 1 0;
    width: 100%;
    height: 100% !important;
    min-height: 72px;
    border: none;
    border-radius: 0;
  }
  body.capture #tvChartWrap .tradingview-widget-copyright {
    display: none;
  }

  body.capture .signal-panel {
    flex: 0 0 auto;
    gap: 6px;
    padding: 8px 12px 10px;
    max-height: 42%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.capture .signal-panel .lbl {
    margin-bottom: 3px;
    font-size: 12px;
  }
  body.capture .signal-panel .input {
    height: 38px;
    font-size: 15px;
  }
  body.capture .sl-row {
    margin-bottom: 3px;
  }

  /* Dock sits on the bottom edge of the visible viewport */
  body.capture .action-bar {
    position: fixed;
    top: calc(var(--vv-top, 0px) + var(--vv-height, 100dvh) - var(--capture-dock-h, 58px) - 6px);
    bottom: auto;
    left: 0;
    right: 0;
    z-index: 75;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 0;
  }
  body.capture .action-bar-inner {
    min-height: 48px;
  }
  body.capture .btn-action {
    height: 44px;
  }
}

