/* Open credit-spread position card — frontend/js/cs-open-card.js (Mockup 2.0, 10/14).
   Grayscale except P/L (--ds-pnl-up/down via .pnl-positive/.pnl-negative) and the
   in-gate warning (--ds-warn / --ds-warn-soft). No accent. Text >= 12px, tap targets
   >= 44px, no sideways scroll at 390px. */
.coc-card { background: var(--ds-surface); border: 1px solid var(--ds-border); border-radius: var(--ds-r-lg);
  padding: 16px; display: grid; gap: 14px; margin-bottom: 12px; min-width: 0;
  font-variant-numeric: tabular-nums; color: var(--ds-text); }
.coc-card > * { min-width: 0; }

/* Header: strikes · width × qty · DTE · P/L open */
.coc-ph { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; }
.coc-id { display: flex; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; }
.coc-strikes { font-size: 18px; font-weight: 600; }
.coc-meta { font-size: 14px; color: var(--ds-muted); }
.coc-meta b { color: var(--ds-text); font-weight: 600; }
.coc-dot { color: var(--ds-border-strong); margin: 0 4px; }
.coc-stale { color: var(--ds-warn); font-weight: 600; font-size: 13px; }
.coc-pnl { display: flex; align-items: baseline; gap: 8px; }
.coc-k { font-size: 12px; color: var(--ds-label); letter-spacing: .04em; text-transform: uppercase; font-weight: 500; }
.coc-pnl .coc-v { font-size: 20px; font-weight: 700; }

/* ⓘ: 44px tap target, 20px visual */
.coc-info { flex: none; width: 44px; height: 44px; margin: -12px -10px -12px -6px; padding: 0; border: 0;
  background: transparent; color: var(--ds-muted); cursor: pointer; display: inline-grid; place-items: center;
  font: inherit; border-radius: var(--ds-r-md); }
.coc-info span { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; display: grid;
  place-items: center; font-size: 12px; font-weight: 700; font-style: italic; font-family: Georgia, serif; line-height: 1; }
.coc-info:hover, .coc-info[aria-expanded="true"] { color: var(--ds-text); }
.coc-info:focus-visible { outline: none; box-shadow: var(--ds-focus-ring); }
.coc-tip { display: none; margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--ds-text);
  background: var(--ds-hover); border: 1px solid var(--ds-border-strong); border-radius: var(--ds-r-md); padding: 10px 12px; }
.coc-tip.open { display: block; }
.coc-tip p { margin: 0; }
.coc-tip p + p { margin-top: 6px; }

/* Meter */
.coc-meter { border: 1px solid var(--ds-border-strong); border-radius: var(--ds-r-md); padding: 12px 14px; }
.coc-mtop { display: flex; justify-content: space-between; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.coc-mhead { display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; font-size: 16px; font-weight: 500; }
.coc-mhead b, .coc-mhead .coc-pct { white-space: nowrap; }
.coc-mhead b { font-size: 20px; font-weight: 700; }
.coc-mhead .coc-pct { color: var(--ds-muted); font-weight: 500; }
.coc-mgate { font-size: 13px; color: var(--ds-muted); }
.coc-mgate b { color: var(--ds-text); font-weight: 600; }
.coc-tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; padding: 1px 7px;
  border-radius: 4px; border: 1px solid currentColor; }

.coc-plot { position: relative; margin: 10px 2px 0; }
.coc-band { position: relative; height: 20px; }
.coc-track { position: relative; height: 28px; }
.coc-rail { position: absolute; left: 0; right: 0; top: 10px; height: 8px; border-radius: 4px; background: var(--ds-hover); }
.coc-zone { position: absolute; top: 10px; height: 8px;
  background: repeating-linear-gradient(135deg, var(--ds-muted) 0 2px, transparent 2px 6px); }
.coc-zone.r { border-radius: 0 4px 4px 0; }
.coc-tick { position: absolute; top: 4px; width: 2px; height: 20px; margin-left: -1px; background: var(--ds-text); }
.coc-tick.thin { width: 1px; margin-left: 0; top: 6px; height: 16px; background: var(--ds-muted); }
.coc-tick.end { background: var(--ds-border-strong); }
.coc-mk { position: absolute; top: 2px; width: 12px; height: 24px; margin-left: -6px; border-radius: 4px;
  background: var(--ds-text); border: 2px solid var(--ds-surface); }
.coc-mk.clamp-l { margin-left: -2px; }
.coc-mk.clamp-r { margin-left: -10px; }
.coc-al { position: absolute; top: 0; white-space: nowrap; font-size: 12px; line-height: 1.3; color: var(--ds-muted); }
.coc-al b { color: var(--ds-text); font-weight: 600; }
.coc-band .coc-al { line-height: 20px; font-size: 13px; color: var(--ds-text); font-weight: 600; }
.coc-band .coc-k2 { color: var(--ds-muted); font-weight: 500; }
.coc-band .coc-al-norm { font-size: 12px; font-weight: 500; color: var(--ds-muted); }
.coc-axis { position: relative; height: 34px; margin-top: 4px; }

/* Inside the gate / ITM: warn token only */
.coc-meter.warn { border-color: var(--ds-warn); background: var(--ds-warn-soft); }
.coc-meter.warn .coc-mhead b, .coc-meter.warn .coc-mhead .coc-tag { color: var(--ds-warn); }
.coc-meter.warn .coc-zone { background: repeating-linear-gradient(135deg, var(--ds-warn) 0 2px, transparent 2px 6px); }
.coc-meter.warn .coc-mk { background: var(--ds-warn); }
.coc-meter.warn .coc-band .coc-al:not(.coc-al-norm) { color: var(--ds-warn); }

/* Condition chips */
.coc-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.coc-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13px;
  border: 1px solid var(--ds-border); border-radius: var(--ds-r-pill); padding: 4px 12px; background: var(--ds-surface); }
.coc-ck { font-weight: 700; width: 14px; text-align: center; }
.coc-chip.met { border-color: var(--ds-border-strong); }
.coc-chip.no .coc-ck { color: var(--ds-muted); }
.coc-n { font-weight: 600; }
.coc-n i { font-style: normal; color: var(--ds-muted); font-weight: 500; }
.coc-meter.warn .coc-chip.met { border-color: var(--ds-warn); }

/* Tiles: Credit · Max loss · Target */
.coc-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.coc-tile { border: 1px solid var(--ds-border); border-radius: var(--ds-r-md); padding: 10px 12px; min-width: 0; }
.coc-tile .coc-v { font-size: 18px; font-weight: 600; margin-top: 2px; }
.coc-tile .coc-s { font-size: 12px; color: var(--ds-muted); }

/* Settings at entry */
.coc-snap { border: 1px solid var(--ds-border); border-radius: var(--ds-r-md); }
.coc-snap summary { list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center;
  gap: 10px; padding: 6px 14px; }
.coc-snap summary::-webkit-details-marker { display: none; }
.coc-snap summary:focus-visible { outline: none; box-shadow: var(--ds-focus-ring); border-radius: var(--ds-r-md); }
.coc-line { flex: 1; min-width: 0; font-size: 13px; color: var(--ds-muted); }
.coc-chev { flex: none; color: var(--ds-muted); transition: transform .15s; }
.coc-snap[open] .coc-chev { transform: rotate(90deg); }
.coc-kvs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px;
  border-top: 1px solid var(--ds-border); padding: 8px 14px 10px; margin: 0; }
.coc-kvs div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0;
  border-bottom: 1px solid var(--ds-border); font-size: 13px; }
.coc-kvs dt { color: var(--ds-label); }
.coc-kvs dd { margin: 0; font-weight: 600; text-align: right; }

.coc-actions { display: flex; justify-content: flex-end; }
/* The bot page already frames it in its "Current Position" card: no second frame. */
#csb-open-card .coc-card { border: 0; padding: 0; background: transparent; margin-bottom: 0; }
.coc-close { min-height: 44px; padding: 0 16px; border-radius: var(--ds-r-md); font: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; background: transparent; color: var(--ds-text); border: 1px solid var(--ds-border-strong); }
.coc-close:hover { background: var(--ds-hover); }
.coc-close:focus-visible { outline: none; box-shadow: var(--ds-focus-ring); }

@media (max-width: 640px) {
  .coc-card { padding: 14px; }
  .coc-ph { flex-direction: column; align-items: flex-start; gap: 2px; }
  .coc-strikes { font-size: 17px; }
  .coc-meter { padding: 12px; }
  .coc-mhead { font-size: 15px; }
  .coc-mhead b { font-size: 18px; }
  .coc-tiles { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--ds-border); border-radius: var(--ds-r-md); }
  .coc-tile { border: 0; border-bottom: 1px solid var(--ds-border); border-radius: 0; display: grid;
    grid-template-columns: auto 1fr; align-items: baseline; gap: 0 10px; padding: 8px 12px; }
  .coc-tile:last-child { border-bottom: 0; }
  .coc-tile .coc-v { font-size: 16px; margin: 0; text-align: right; }
  .coc-tile .coc-s { grid-column: 1 / -1; }
  .coc-kvs { grid-template-columns: 1fr; }
  /* the one-line summary drops under its label instead of a narrow column */
  .coc-snap summary { flex-wrap: wrap; gap: 2px 10px; padding: 8px 14px; }
  .coc-snap .coc-k { flex: 1; }
  .coc-line { order: 3; flex-basis: 100%; }
  .coc-actions { justify-content: stretch; }
  .coc-close { width: 100%; }
}
