/* FNO Trading: shared design tokens and components (from redesign/shared.css).
   Page-specific rules live in each template's own <style> block. */
  :root {
    --bg: #f4f1ea;
    --surface: #ffffff;
    --surface-2: #faf8f3;
    --line: #e6e1d6;
    --line-strong: #d6d0c2;
    --text: #1c1917;
    --muted: #6b655d;
    --faint: #9a948a;
    --primary: #0e6b7e;
    --primary-dark: #0b5667;
    --primary-tint: #e6f2f4;
    --pos: #1d8a4b;
    --pos-tint: #e7f4ec;
    --neg: #b8342a;
    --neg-tint: #fbeceb;
    --warn: #8a4b0c;
    --warn-tint: #fdf1dc;
    --radius: 10px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html { -webkit-font-smoothing: antialiased; }
  body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    min-height: 100vh;
  }
  .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
  .pos { color: var(--pos); }
  .neg { color: var(--neg); }
  .muted { color: var(--muted); }
  svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

  /* Top bar */
  .topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
  .topbar-in { max-width: 1360px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 28px; }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
  .brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--primary); display: grid; place-items: center; color: #fff; }
  .tabs { display: flex; gap: 4px; height: 100%; }
  .tab { display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
  .tab:hover { color: var(--text); }
  .tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
  .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
  .status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
  .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px var(--pos-tint); }
  .sep { width: 1px; height: 20px; background: var(--line); }
  .seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
  .seg button { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 3px 10px; border-radius: 6px; cursor: pointer; }
  .seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(28,25,23,.12); }
  .seg button.on-pos { background: var(--pos); color: #fff; box-shadow: none; }
  .seg button.on-neg { background: var(--neg); color: #fff; box-shadow: none; }
  .link { color: var(--muted); text-decoration: none; font-size: 13px; display: flex; align-items: center; gap: 6px; }
  .link:hover { color: var(--text); }

  /* Buttons */
  .btn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
  .btn:hover { background: var(--surface-2); }
  .btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
  .btn.primary:hover { background: var(--primary-dark); }
  .btn.danger { color: var(--neg); border-color: #e9c1bd; }
  .btn.danger:hover { background: var(--neg-tint); }
  .btn[disabled] { opacity: .5; cursor: not-allowed; }
  .icon-btn { width: 28px; height: 28px; padding: 0; justify-content: center; border-radius: 7px; }
  .icon-btn.go { color: var(--pos); }
  .icon-btn.hold { color: var(--warn); }
  .icon-btn.halt { color: var(--neg); }

  /* Page */
  .page { max-width: 1360px; margin: 0 auto; padding: 20px 24px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  .card-h { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 14px 18px 0; }
  .card-h h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.005em; }
  .label { font-size: 12.5px; color: var(--muted); }

  .row-a { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 3fr) minmax(0, 4fr); gap: 16px; }

  /* Net P&L */
  .hero { padding: 18px 20px 14px; display: flex; flex-direction: column; gap: 10px; }
  .hero-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
  .hero-value { font-size: 36px; line-height: 1.05; font-weight: 650; letter-spacing: -0.025em; white-space: nowrap; }
  .hero-split { display: flex; gap: 22px; text-align: right; white-space: nowrap; }
  .hero-split b { display: block; font-size: 17px; font-weight: 650; }
  .spark-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); margin-top: -2px; }

  /* Prices */
  .prices { padding: 6px 18px 10px; display: grid; }
  .price-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 14px; padding: 12px 0; }
  .price-row + .price-row { border-top: 1px solid var(--line); }
  .sym { font-size: 12.5px; color: var(--muted); font-weight: 600; }
  .price { font-size: 24px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.15; }
  .chg { font-size: 12.5px; font-weight: 600; }
  .prices-foot { border-top: 1px solid var(--line); padding: 10px 18px; font-size: 12px; color: var(--faint); display: flex; justify-content: space-between; }

  /* Stat tiles */
  .tiles { display: grid; grid-template-columns: repeat(3, 1fr); }
  .tile { padding: 16px 14px 16px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .tile:nth-child(3n) { border-right: 0; }
  .tile:nth-last-child(-n+3) { border-bottom: 0; }
  .tile b { display: block; font-size: 22px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.2; margin-top: 2px; white-space: nowrap; }
  .tile small { font-size: 12px; color: var(--faint); }

  /* Portfolio limits */
  .limits { display: flex; align-items: center; gap: 24px; padding: 12px 18px; flex-wrap: wrap; }
  .limits-title { display: flex; align-items: center; gap: 10px; min-width: 190px; }
  .limits-title .ico { width: 32px; height: 32px; border-radius: 8px; background: var(--primary-tint); color: var(--primary); display: grid; place-items: center; }
  .limits-title h2 { font-size: 15px; font-weight: 650; }
  .limits-title p { font-size: 12px; color: var(--muted); }
  .fields { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; align-items: flex-end; }
  .field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
  .field input { width: 118px; font: inherit; font-size: 13.5px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); }
  .field input:disabled { background: var(--surface-2); color: var(--faint); cursor: not-allowed; }
  .limits-state { display: flex; align-items: center; gap: 12px; margin-left: auto; }
  .pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
  .pill.pos { background: var(--pos-tint); color: var(--pos); }
  .pill.pos::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--pos); }
  .pill.warn { background: var(--warn-tint); color: var(--warn); }
  .pill.warn::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #d98a1c; }
  .pill.off { background: #efece4; color: var(--muted); }
  .pill.off::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }

  /* Strategy table */
  .toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); }
  .stepper button { width: 26px; height: 28px; border: 0; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; }
  .stepper button:hover { background: var(--surface-2); color: var(--text); }
  .stepper span { min-width: 30px; text-align: center; font-weight: 600; font-size: 13px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); line-height: 28px; }
  .stepper.sm button { width: 22px; height: 24px; }
  .stepper.sm span { min-width: 26px; line-height: 24px; font-size: 12.5px; }

  table { width: 100%; border-collapse: collapse; }
  .tbl-wrap { overflow-x: auto; padding: 12px 6px 6px; }
  th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
  td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  th.r, td.r { text-align: right; }
  th.c, td.c { text-align: center; }
  tr.strat { cursor: pointer; }
  tr.strat:hover td { background: var(--surface-2); }
  tr.strat.open td { background: var(--primary-tint); border-bottom-color: transparent; }
  .name { display: flex; align-items: center; gap: 8px; }
  .chev { color: var(--faint); transition: transform .15s; }
  tr.strat.open .chev { transform: rotate(90deg); color: var(--primary); }
  .name b { font-weight: 600; }
  .name small { display: block; font-size: 12px; color: var(--muted); }
  .tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 5px; margin-left: 6px; vertical-align: 1px; }
  .tag.main { background: var(--primary-tint); color: var(--primary-dark); }
  tr.strat.open .tag.main { background: #fff; }
  .tag.acc2 { background: #f3ead4; color: #7a5f22; }
  .chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
  .chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .chip.running { background: var(--pos-tint); color: var(--pos); }
  .chip.paused { background: var(--warn-tint); color: var(--warn); }
  .chip.stopped { background: #efece4; color: var(--muted); }
  .run { font-size: 12px; font-weight: 600; color: var(--primary-dark); background: var(--primary-tint); border-radius: 999px; padding: 2px 9px; }
  tr.strat.open .run { background: #fff; }
  .signal { display: inline-flex; align-items: center; gap: 8px; }
  .signal .icon-btn { width: 22px; height: 22px; color: var(--faint); border-color: transparent; background: transparent; }
  .signal .icon-btn:hover { color: var(--primary); background: var(--primary-tint); }
  .acts { display: flex; justify-content: flex-end; gap: 6px; }

  tr.detail > td { padding: 0 6px 14px; background: var(--primary-tint); border-bottom: 1px solid var(--line); }
  .detail-in { background: var(--surface); border: 1px solid #cfe3e8; border-radius: 8px; margin: 0 6px; overflow: hidden; }
  .detail-in table th { background: var(--surface-2); padding: 7px 12px; }
  .detail-in td { padding: 8px 12px; font-size: 13px; background: transparent !important; }
  .detail-in tr:last-child td { border-bottom: 0; }
  .detail-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; font-size: 13px; }
  .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
  .side { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 5px; }
  .side.short { background: var(--neg-tint); color: var(--neg); }
  .side.long { background: var(--pos-tint); color: var(--pos); }

  .foot { text-align: center; font-size: 12px; color: var(--faint); padding-top: 4px; }

  @media (max-width: 1100px) {
    .row-a { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .hero-card { grid-column: 1 / -1; }
    .topbar-right .hide-md { display: none; }
  }
  @media (max-width: 720px) {
    .row-a { grid-template-columns: minmax(0, 1fr); }
    .hero-value { font-size: 30px; }
    .card-h { flex-wrap: wrap; }
    .link .lbl { display: none; }
    .topbar-in { gap: 12px; padding: 0 12px; }
    .page { padding: 12px; }
    .hero-top { flex-direction: column; align-items: flex-start; }
    .hero-split { text-align: left; }
    .tab span { display: none; }
  }

/* ---- Shared form controls, banners, pagination (used by pages other than index) ---- */
.input, .select {
  font: inherit; font-size: 13.5px; padding: 7px 10px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: var(--surface); color: var(--text); min-width: 0;
}
.input:focus, .select:focus { outline: 2px solid var(--primary-tint); border-color: var(--primary); }
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b655d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.control label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.2; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius); font-size: 13.5px; }
.banner.warn { background: var(--warn-tint); color: var(--warn); border: 1px solid #f0d9ac; }
.banner.info { background: var(--primary-tint); color: var(--primary-dark); border: 1px solid #cfe3e8; }
.banner svg.i { margin-top: 2px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager .pages { display: flex; gap: 4px; }
.pager .pg { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid transparent; background: transparent; font: inherit; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.pager .pg:hover { background: var(--surface-2); }
.pager .pg.on { background: var(--primary); color: #fff; }
.pager .pg.ghost { border-color: var(--line-strong); background: var(--surface); }
.chip.failed { background: var(--neg-tint); color: var(--neg); }
.chip.open { background: var(--primary-tint); color: var(--primary-dark); }
.chip.closed { background: #efece4; color: var(--muted); }
.mk { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
.mk.done { background: var(--primary); }
.mk.live { border: 2px solid var(--pos); }
.subtabs { display: inline-flex; gap: 2px; background: #ebe7dc; border-radius: 10px; padding: 3px; }
.subtabs button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.subtabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(28,25,23,.14); }

a.btn { text-decoration: none; }

/* ---- FNO additions: Vue cloak, kill switch (original "bolt FNO" form), modals, toasts, misc ---- */
[v-cloak] { display: none !important; }
a.brand { color: inherit; text-decoration: none; }
.tab svg.i, .brand-mark svg.i { pointer-events: none; }

/* Kill switch: keeps the original bolt + "FNO" button, opens a confirmation popup */
.ks-btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 13px; font-weight: 650; padding: 6px 14px; border-radius: 8px; border: 1px solid #bfdde3; background: linear-gradient(135deg, #cfeaee 0%, #e4e0f5 100%); color: #0b4a58; cursor: pointer; white-space: nowrap; transition: filter .15s; }
.ks-btn:hover { filter: brightness(.96); }
.ks-btn .bolt { font-size: 15px; line-height: 1; }
.ks-btn.engaged { background: var(--neg); border-color: var(--neg); color: #fff; cursor: not-allowed; animation: ks-pulse 1.6s ease-in-out infinite; }
@keyframes ks-pulse { 50% { opacity: .7; } }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(28,25,23,.46); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(28,25,23,.28); width: 100%; max-width: 440px; max-height: 92vh; display: flex; flex-direction: column; }
.modal.md { max-width: 560px; }
.modal.lg { max-width: 780px; }
.modal.xl { max-width: 980px; height: 90vh; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.005em; display: flex; align-items: center; gap: 10px; }
.modal-h .sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.modal-b { padding: 16px 20px; overflow-y: auto; min-height: 0; flex: 1; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.modal-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-tint); color: var(--primary); flex: none; font-size: 18px; }
.modal-ico.danger { background: var(--neg-tint); color: var(--neg); }
.btn.solid-danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.solid-danger:hover { background: #9c2a21; }
.btn.success { background: var(--pos); border-color: var(--pos); color: #fff; }
.btn.success:hover { background: #17703d; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.warn { color: var(--warn); border-color: #ecd4a6; }
.btn.warn:hover { background: var(--warn-tint); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }

/* Toasts */
.toasts { position: fixed; top: 14px; right: 14px; z-index: 100; display: grid; gap: 8px; width: min(380px, calc(100vw - 28px)); pointer-events: none; }
.toast { padding: 10px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: #fff; box-shadow: 0 10px 28px rgba(28,25,23,.22); background: var(--text); }
.toast.success { background: var(--pos); }
.toast.danger, .toast.error { background: var(--neg); }
.toast.warning { background: #b7791f; }
.toast.info { background: var(--primary); }
.toast-enter-active, .toast-leave-active { transition: opacity .4s, transform .4s; }
.toast-enter-from, .toast-leave-to { opacity: 0; transform: translateX(40px); }

/* Misc shared bits */
.spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .9s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 14.5px; margin-bottom: 2px; }
.empty small { color: var(--faint); font-size: 12.5px; }
.chip.cap { text-transform: capitalize; }
.chip.muted { background: #efece4; color: var(--muted); }
.chip.info { background: var(--primary-tint); color: var(--primary-dark); }
.chip.warn { background: var(--warn-tint); color: var(--warn); }
.chip.pos { background: var(--pos-tint); color: var(--pos); }
.chip.neg { background: var(--neg-tint); color: var(--neg); }
.chip.orange { background: #fde8d6; color: #9a4a0a; }
.chip.violet { background: #ece6f7; color: #5b3a9c; }
.chip.sq { border-radius: 5px; padding: 1px 7px; font-size: 11.5px; }
.chip.sq::before { display: none; }
.buy { color: var(--pos); font-weight: 600; }
.sell { color: var(--neg); font-weight: 600; }
.sub2 { display: block; font-size: 11.5px; color: var(--faint); }
.err { display: block; font-size: 12px; color: var(--neg); margin-top: 2px; }
.hidden { display: none !important; }
.num-in { text-align: right; }
.icon-btn.sm { width: 24px; height: 24px; }
.btn.icon-btn.exit { color: var(--warn); }
.stepper input { width: 40px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font: inherit; font-weight: 600; font-size: 13px; height: 28px; background: transparent; color: var(--text); -moz-appearance: textfield; appearance: textfield; padding: 0; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.sm input { width: 34px; height: 24px; font-size: 12.5px; }
.stepper input:focus { outline: 2px solid var(--primary-tint); }
.dot.warn { background: #d98a1c; box-shadow: 0 0 0 3px var(--warn-tint); }
.dot.neg { background: var(--neg); box-shadow: 0 0 0 3px var(--neg-tint); }
.dot.info { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.dot.off { background: var(--faint); box-shadow: 0 0 0 3px #efece4; }

/* Phones: drop the brand name so the kill switch and log out stay on screen */
@media (max-width: 480px) {
  .brand-name { display: none; }
  .topbar-right { gap: 8px; }
  .ks-btn { padding: 6px 10px; }
}
