/* ==========================================================================
   ui/stock.css — the slide-in stock panel (right side) and the order sheet.
   Class names start with sp- / os- so they never clash with older pages.
   ========================================================================== */
.sp-shade { position: fixed; inset: 0; background: rgba(0, 0, 0, .32); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 70; }
.sp { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg); z-index: 71;
      transform: translateX(102%); transition: transform .24s ease; display: flex; flex-direction: column;
      box-shadow: -10px 0 40px rgba(0, 0, 0, .16); font-family: var(--disp); color: var(--text); font-size: 13px; }
body.sp-open .sp { transform: none; }
body.sp-open .sp-shade { opacity: 1; pointer-events: auto; }
body.sp-open { overflow: hidden; }

.sp-head { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.sp-top { display: flex; align-items: center; gap: 8px; }
.sp-top b { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.sp-top .sp-sec { color: var(--muted); font-size: 12px; }
.sp-x { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--panel2); color: var(--text);
        display: grid; place-items: center; cursor: pointer; font-size: 18px; flex: none; }
.sp-px { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.sp-px .v { font-size: 24px; font-weight: 600; letter-spacing: -.02em; border-radius: 6px; padding: 0 3px; margin-left: -3px; }
.sp-px .c { font-size: 13px; font-weight: 600; }
.sp-px .t { font-size: 11px; color: var(--dim); }
.sp-acts { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; margin-top: 10px; }
.sp-acts button, .sp-acts a { border: 0; border-radius: 12px; padding: 10px 8px; font-weight: 800; font-size: 13px; cursor: pointer;
                              text-align: center; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 6px; }
.sp-buy { background: var(--buy); color: #fff; }
.sp-sell { background: var(--sell); color: #fff; }
html body a.sp-chart, .sp-chart { background: var(--ink); color: #fff; }
.sp-acts button:hover, .sp-acts a:hover { filter: brightness(1.08); }

.sp-body { overflow-y: auto; flex: 1; padding: 12px 14px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.sp-card { background: var(--panel); border-radius: 16px; padding: 12px; }
.sp-card h4 { font-size: 11px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 9px;
              display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sp-card h4 .seg { text-transform: none; letter-spacing: 0; }
.sp-sig { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sp-sig div { background: var(--panel2); border-radius: 12px; padding: 8px 10px; font-size: 11px; color: var(--muted); }
.sp-sig b { display: block; font-size: 17px; color: var(--text); margin: 2px 0 4px; }
.sp-verdict { font-size: 12.5px; line-height: 1.5; background: var(--accent-soft); border-radius: 12px; padding: 9px 11px; margin-top: 9px; }
.sp-fac { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.sp-f { font-size: 11.5px; min-width: 0; }
.sp-f .top { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); }
.sp-f .top b { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-f .bar { height: 5px; border-radius: 999px; background: var(--panel2); margin-top: 4px; overflow: hidden; }
.sp-f .bar i { display: block; height: 100%; border-radius: 999px; }
.sp-tg { display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.sp-tg .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.sp-tg .lv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sp-tg .lv div { background: var(--panel2); border-radius: 10px; padding: 6px 8px; font-size: 10.5px; color: var(--muted); }
.sp-tg .lv b { display: block; font-size: 12.5px; color: var(--text); }
.sp-votes .v { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.sp-votes .v:first-of-type { border-top: 0; }
.sp-votes .v small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.sp-news .n { display: flex; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.45; }
.sp-news .n:first-child { border-top: 0; }
.sp-news .n i { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.sp-news .n small { color: var(--dim); font-size: 10.5px; }
.sp-chartbox { min-height: 160px; }
.sp-chartbox svg { display: block; width: 100%; height: auto; }
.sp-cnote { font-size: 11px; color: var(--dim); margin-top: 6px; display: flex; justify-content: space-between; gap: 8px; }
.sp-empty { color: var(--dim); font-size: 12px; padding: 4px 0; }

/* order sheet */
.os-shade { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 14px; }
.os { background: var(--panel); color: var(--text); border-radius: 20px; padding: 18px; width: min(380px, 100%); font-family: var(--disp);
      display: flex; flex-direction: column; gap: 10px; max-height: 92vh; overflow-y: auto; }
.os-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.os-h b { font-size: 17px; }
.os-h span { color: var(--muted); font-size: 12px; }
.os-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.os label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 600; }
.os input, .os select { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 9px 10px;
                        font-size: 14px; font-family: inherit; width: 100%; }
.os input:focus, .os select:focus { outline: none; border-color: var(--accent); }
.os-est { font-size: 12px; color: var(--muted); background: var(--panel2); border-radius: 10px; padding: 8px 10px; }
.os-warn { font-size: 11.5px; color: var(--sell); }
.os-go { border: 0; border-radius: 12px; padding: 12px; font-weight: 800; font-size: 14px; color: #fff; cursor: pointer; font-family: inherit; }
.os-go:disabled { opacity: .6; cursor: default; }
.os-x { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 12px; padding: 9px; cursor: pointer; font-family: inherit; }
.os-res { font-size: 12.5px; min-height: 16px; }

/* small B / S buttons inside tables */
.bs { display: inline-flex; gap: 4px; }
.bs button { border: 0; border-radius: 7px; font-weight: 800; font-size: 11px; padding: 4px 8px; cursor: pointer; color: #fff; font-family: inherit; }
.bs .b { background: var(--buy); } .bs .s { background: var(--sell); }
[data-stock] { cursor: pointer; }
