/* ── NEXT BLOCK OTC TRADING PLATFORM STYLESHEET (REFINED DESIGN SYSTEM) ── */

@import url('index.css?v=6.7.0');

:root {
  --font-mono: 'Azeret Mono', monospace;

  /* ── TRADING UI: Brand → teal-green (green-*, H=155°). Lime is logo-only. ── */

  /* Bid/success text: use green-600 (L=63%) not green-500 (L=73%) — 장시간 호가 읽기 피로도 감소 */
  --text-success:            var(--green-600);   /* #00A26F — TradingView 수준 luminance */
  --text-price-up:           var(--green-400);   /* flash up: 더 밝음 */

  /* Ask/danger text: red-500 (L=63%) 유지 — 충분히 낮은 luminance */

  /* Brand tokens: use teal-green scale (index.css green-* is now H=155°) */
  --fill-brand:              var(--green-500);
  --fill-brand-subtle:       var(--green-900);
  --fill-brand-hover:        var(--green-400);
  --fill-brand-pressed:      var(--green-300);
  --fill-brand-disabled:     var(--gray-700);
  --text-brand:              var(--green-500);
  --text-brand-subtle:       var(--green-200);
  --border-brand-subtle:     var(--green-800);

  /* Brand solid fills — restrained, institutional teal-green */
  --fill-brand-solid:        oklch(55% 0.100 155.0);   /* calm teal, less lime than green-500 */
  --fill-brand-solid-hover:  oklch(60% 0.110 155.0);
  --fill-brand-solid-active: oklch(50% 0.090 155.0);
  --fill-brand-subtle-hover: var(--green-800);
  --icon-brand:              var(--green-500);

  /* Interactive / selected states */
  --fill-surface-selected:   oklch(73.00% 0.150 155.0 / 0.16); /* green-500 alpha */
  --fill-nav-active:         var(--green-900);
  --text-nav-active:         var(--green-500);
  --border-nav-active:       var(--green-500);
  --border-selected:         var(--green-500);

  /* Focus rings — always neutral, never brand color */
  --border-focus:            oklch(100% 0 0 / 0.45);
  --border-input-focus:      oklch(100% 0 0 / 0.45);
  --shadow-focus:            0 0 0 2px var(--fill-base), 0 0 0 3px oklch(100% 0 0 / 0.30);

  /* Glow */
  --shadow-brand-glow:       0 4px 20px oklch(62.96% 0.130 155.0 / 0.30);

  /* Trading action aliases */
  --color-bid:               var(--text-success);
  --color-bid-text:          var(--text-success);
  --color-ask:               var(--text-danger);
  --color-ask-text:          var(--text-danger);
  --color-info:              var(--text-info);
  --color-warning:           var(--text-warning);
}

/* Light mode adjustments */
:root[data-theme="light"] {
  --text-success:            oklch(46% 0.085 155.0);   /* desaturated teal — 4.5:1 on white, not fluorescent */
  --text-price-up:           oklch(50% 0.095 155.0);   /* flash up: slightly brighter than text-success */
  --fill-brand:              oklch(42% 0.080 155.0);
  --fill-brand-subtle:       oklch(97% 0.012 155.0);
  --fill-brand-hover:        oklch(36% 0.070 155.0);
  --fill-brand-solid:        oklch(38% 0.075 155.0);   /* deep forest green — calm, institutional */
  --fill-brand-solid-hover:  oklch(34% 0.070 155.0);
  --fill-brand-solid-active: oklch(30% 0.065 155.0);
  --fill-brand-subtle-hover: oklch(95% 0.018 155.0);
  --text-brand:              oklch(42% 0.080 155.0);
  --text-brand-subtle:       oklch(50% 0.075 155.0);
  --icon-brand:              oklch(42% 0.080 155.0);
  --fill-surface-selected:   oklch(42% 0.080 155.0 / 0.10);
  --fill-nav-active:         oklch(97% 0.012 155.0);
  --text-nav-active:         oklch(42% 0.080 155.0);
  --border-nav-active:       oklch(42% 0.080 155.0);
  /* Focus rings — neutral in light mode */
  --border-focus:            oklch(0% 0 0 / 0.35);
  --border-input-focus:      oklch(0% 0 0 / 0.35);
  --shadow-focus:            0 0 0 2px var(--fill-base), 0 0 0 3px oklch(0% 0 0 / 0.20);
}

/* Light mode: qcr best-price buttons — tint fill only when .best */
/* Light mode: transparent backgrounds on layout containers (panels handle their own surfaces) */
[data-theme="light"] .main,
[data-theme="light"] .center-panel,
[data-theme="light"] .center-left-col,
[data-theme="light"] .center-bottom {
  background: transparent;
}

/* Light mode: rfq-ticket-panel overrides (reset sticky from trading-layout context) */
[data-theme="light"] .rfq-ticket-panel {
  position: static;
  max-height: none;
  overflow: hidden;
  align-self: auto;
}

/* ── BASE & RESET OVERRIDES ── */
body {
  background: var(--fill-base);
  background-image: var(--gradient-page-bg);
  background-attachment: fixed;
  color: var(--text-neutral-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-body-sm);
  line-height: 1.25;
}

/* Global: prevent lime from bleeding into checkbox accent-color */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--gray-500);
}

/* ── Light mode focus: neutral, never green ── */
[data-theme="light"] .input-nb:focus,
[data-theme="light"] .select-nb:focus {
  border-color: oklch(0% 0 0 / 0.35) !important;
  box-shadow: 0 0 0 2px oklch(0% 0 0 / 0.10) !important;
}

h1, h2, h3, h4, h5, h6,
.app-title,
.panel-header,
.summary-title,
.summary-price-big {
  font-family: var(--font-display);
}

/* ── HEADER ── */
.app-header {
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--fill-surface);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 44px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  height: 24px;
  width: auto;
  display: block;
  flex-shrink: 0;
  overflow: visible;
}

.app-title {
  font-size: var(--font-size-body-md);
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.app-title span {
  color: var(--color-bid-text);
}

.nav-links {
  display: flex;
  gap: 2px;
  margin-left: 12px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-neutral-tertiary);
  padding: 3px 8px;
  border-radius: 2px;
  font-size: var(--font-size-body-sm);
  font-weight: 500;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.nav-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gray-alpha-8);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.nav-btn:hover::after {
  opacity: 1;
}

.nav-btn:hover {
  color: var(--text-neutral-primary);
}

.nav-btn:active::after {
  background: var(--gray-alpha-24);
  opacity: 1;
}

.nav-btn.active {
  background: var(--fill-surface-raised);
  color: var(--text-neutral-primary);
  font-weight: 600;
}

.header-stats-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
}

.header-stats-bar span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.header-stats-bar em {
  font-style: normal;
  color: var(--text-neutral-secondary);
}

/* Blue backdrop stat tag matching screenshot */
.header-stat-tag-blue {
  background: var(--fill-info-subtle);
  color: var(--text-info) !important;
  border: 1px solid rgba(74, 143, 232, 0.15);
  padding: 2px 6px;
  border-radius: 2px;
}

.status-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-bid-text);
}

/* ── LAYOUT ── */
.trading-container {
  padding: 6px;
  max-width: 1920px;
  margin: 0 auto;
}

.trading-layout {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  gap: 8px;
}

@media (max-width: 1200px) {
  .trading-layout {
    grid-template-columns: 180px 1fr 260px;
  }
}

@media (max-width: 992px) {
  .trading-layout {
    grid-template-columns: 1fr;
  }
}

/* Panel Tiling */
.panel {
  background: var(--fill-surface);
  background-image: var(--gradient-panel-top);
  border-radius: 0;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-header {
  font-size: var(--font-size-caption);
  font-weight: 700;
  color: var(--text-neutral-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── LEFT COLUMN: WATCHLIST — full viewport height, sticky ── */
.trading-layout > aside:first-child {
  align-self: start;
  position: sticky;
  top: 50px;
  max-height: calc(100vh - 56px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.watchlist-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.watchlist-item {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 5px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  position: relative;
  overflow: hidden;
  transition: background 0.12s;
}

.watchlist-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gray-alpha-8);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.watchlist-item:hover::after {
  opacity: 1;
}

.watchlist-item:active::after {
  background: var(--gray-alpha-24);
  opacity: 1;
}

.watchlist-item.active {
  background: var(--fill-surface-overlay);
}

.watchlist-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.watchlist-pair {
  font-size: var(--font-size-body-sm);
  font-weight: 700;
  color: var(--text-neutral-primary);
}

.watchlist-name {
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
  text-transform: uppercase;
}

.watchlist-price-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.watchlist-price {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: var(--font-size-body-sm);
  font-weight: 600;
}

.watchlist-price.text-success { color: var(--color-bid-text); }
.watchlist-price.text-danger { color: var(--color-ask-text); }
.watchlist-price.text-warning { color: var(--color-warning); }

.watchlist-change {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: var(--font-size-caption);
  font-weight: 500;
}

.watchlist-change.text-success { color: var(--color-bid-text); }
.watchlist-change.text-danger { color: var(--color-ask-text); }
.watchlist-change.text-warning { color: var(--color-warning); }

/* Blinking ticks (softer background tints, text keeps neutral to avoid glare) */
.watchlist-price.tick-up {
  background: var(--fill-success-subtle) !important;
}

.watchlist-price.tick-down {
  background: var(--fill-danger-subtle) !important;
}

/* ── CENTER COLUMN: MAIN VIEW ── */
.trading-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Ticker summary card */
.price-summary-card {
  padding: 10px 14px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.price-main-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-title {
  font-size: var(--font-size-caption);
  font-weight: 700;
  color: var(--text-neutral-tertiary);
}

.summary-price-big {
  font-size: var(--font-size-title-lg);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-neutral-primary);
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1;
}

.summary-price-big em {
  font-size: var(--font-size-body-sm);
  font-style: normal;
  color: var(--text-neutral-tertiary);
  font-weight: 500;
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

.summary-quick-stats {
  display: flex;
  gap: 8px;
}

.quick-bid-card, .quick-ask-card {
  background: var(--fill-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: 2px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 120px;
}

.quick-lbl {
  font-size: var(--font-size-caption);
  font-weight: 700;
  color: var(--text-neutral-tertiary);
}

.quick-lbl.bid { color: var(--color-bid-text); }
.quick-lbl.ask { color: var(--color-ask-text); }

.quick-val {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: var(--font-size-body-md);
  font-weight: 700;
}

.quick-val.bid { color: var(--color-bid-text); }
.quick-val.ask { color: var(--color-ask-text); }

.quick-qty {
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* ── DUAL ORDERBOOKS ── */
.orderbooks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.orderbook-panel {
  padding: 10px;
}

.orderbook-container {
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: var(--font-size-caption);
  margin-top: 6px;
}

.ob-header-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
  text-transform: uppercase;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2px;
}

.ob-header-row span:nth-child(2) { text-align: right; }
.ob-header-row span:nth-child(3) { text-align: right; }

.orderbook-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  padding: 4px 6px;
  position: relative;
  align-items: center;
}

.orderbook-row:hover {
  background: var(--fill-surface-raised);
}

.ob-price {
  font-weight: 600;
  z-index: 2;
}

.ob-price.ask { color: var(--color-ask-text); }
.ob-price.bid { color: var(--color-bid-text); }

.ob-size {
  color: var(--text-neutral-secondary);
  text-align: right;
  z-index: 2;
}

.ob-total {
  color: var(--text-neutral-tertiary);
  text-align: right;
  z-index: 2;
}

.ob-bar {
  position: absolute;
  top: 1px;
  bottom: 1px;
  right: 0;
  height: calc(100% - 2px);
  z-index: 1;
  opacity: 0.04;
}

.ob-bar.ask { background: var(--color-ask-text); }
.ob-bar.bid { background: var(--color-bid-text); }

.ob-spread {
  padding: 6px 8px;
  background: var(--fill-surface-raised);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin: 6px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
  font-weight: 600;
}

/* Stacked orderbook (Upbit style) */
.orderbook-stacked .ask-block {
  display: flex;
  flex-direction: column-reverse;
}

.orderbook-stacked .bid-block {
  display: flex;
  flex-direction: column;
}

/* ── DEALER QUOTES PANEL ── */
.dealer-quotes-panel {
  display: none;
}

.dealer-quotes-panel.active {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dealer-quote-row {
  background: var(--fill-surface-raised);
  border: 1px solid var(--border-default);
  border-radius: 2px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dealer-quote-row.best-price {
  background: oklch(100% 0 0 / 0.03);
  border-color: var(--border-strong);
}

.dealer-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}

.dealer-name {
  font-size: var(--font-size-body-sm);
  font-weight: 700;
  color: var(--text-neutral-primary);
}

.dealer-badge {
  font-size: var(--font-size-caption);
  font-weight: 700;
  padding: 0 3px;
  border-radius: 1px;
  text-transform: uppercase;
}

.dealer-badge.best {
  background: var(--fill-surface-overlay);
  color: var(--text-neutral-primary);
  border: 1px solid var(--border-default);
}

.dealer-badge.regular {
  background: var(--fill-info-subtle);
  color: var(--text-info);
  border: 1px solid rgba(74, 143, 232, 0.15);
}

.dealer-grid-data {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dealer-data-col {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.dealer-data-lbl {
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
}

.dealer-data-price {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: var(--font-size-body-sm);
  font-weight: 700;
  color: var(--text-neutral-secondary);
}

.dealer-data-price.bid {
  color: var(--text-success);
}

.dealer-data-price.ask {
  color: var(--text-danger);
}

.dealer-data-price.best-side {
  font-weight: 800;
  filter: brightness(1.2);
}

.dealer-data-vol {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
}

/* ── PRICE COMPARISON PANEL ── */
.price-compare-panel {
  display: none;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.compare-col {
  background: var(--fill-surface-raised);
  border-radius: 2px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compare-col-header {
  font-size: var(--font-size-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-neutral-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.compare-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compare-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-body-sm);
}

.compare-lbl {
  color: var(--text-neutral-tertiary);
}

.compare-val {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-weight: 600;
}

.compare-val.brand {
  color: var(--color-bid-text);
}

/* ── PRICE COMPARISON: two-provider duel layout ── */

/* cmp-duel: NB | vs | Upbit */
.cmp-duel {
  display: grid;
  grid-template-columns: 1fr 24px 1fr;
  align-items: center;
  gap: 0;
  padding: 4px 0;
}

/* Left side (NB) */
.cmp-side {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Right side (Upbit) */
.cmp-side.right {
  text-align: right;
  align-items: flex-end;
}

.cmp-side-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-neutral-tertiary);
}

.cmp-side-price {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: var(--font-size-body-md);
  font-weight: 700;
  color: var(--text-neutral-secondary);
  line-height: 1.1;
}

/* NB always wins — green on unit price */
.cmp-side.winner .cmp-side-price {
  color: var(--text-success);
}

.cmp-side-total {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
  font-weight: 400;
}

.cmp-vs {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-neutral-disabled);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Bottom result bar */
.cmp-result {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border-subtle);
}

.cmp-result-label {
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
  font-weight: 500;
}

.cmp-result-right {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.cmp-result-pct {
  font-size: var(--font-size-body-sm);
  font-weight: 800;
  color: var(--text-success);
  font-variant-numeric: tabular-nums;
}

.cmp-result-amt {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  font-size: var(--font-size-caption);
  font-weight: 600;
  color: var(--text-neutral-secondary);
}

/* ── RIGHT COLUMN: RFQ / QUOTES PANEL — full viewport height, sticky ── */
.rfq-ticket-panel {
  align-self: start;
  position: sticky;
  top: 50px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}

/* ── QUOTES SECTION (right panel active state) ── */
.rfq-quotes-section {
  display: none;
}

.rfq-ticket-panel.quotes-active .rfq-quotes-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Collapse extended form fields when quotes are active */
.rfq-ticket-panel.quotes-active .rfq-extended-fields {
  display: none;
}

/* ── Market best vs dealer list ── */
.qcr-best-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-default);
  container-type: inline-size;
  container-name: qcr-best;
}

.qcr-dealer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qcr-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 0 2px;
}

.qcr-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-neutral-secondary);
}

.qcr-best-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qcr-best-card {
  flex: 1 1 calc(50% - 3px);
  min-width: min(100%, 11.5rem);
  max-width: 100%;
  border-radius: 5px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 76px;
  box-sizing: border-box;
}

@container qcr-best (max-width: 520px) {
  .qcr-best-banner {
    flex-direction: column;
  }
  .qcr-best-card {
    flex: 1 1 auto;
    width: 100%;
  }
}

@container qcr-best (max-width: 380px) {
  .qcr-best-card {
    flex-direction: column;
    align-items: stretch;
  }
  .qcr-best-exec-btn {
    width: 100%;
    max-width: none;
  }
}

.qcr-best-card.bid {
  background: oklch(26% 0.07 155);
  border: 1px solid oklch(42% 0.09 155 / 0.55);
}

.qcr-best-card.ask {
  background: oklch(24% 0.08 25);
  border: 1px solid oklch(42% 0.12 25 / 0.5);
}

[data-theme="light"] .qcr-best-card.bid {
  background: oklch(92% 0.055 155);
  border-color: oklch(78% 0.1 155);
}

[data-theme="light"] .qcr-best-card.ask {
  background: oklch(93% 0.045 25);
  border-color: oklch(80% 0.1 25);
}

[data-theme="light"] .qcr-best-card.bid .qcr-best-label,
[data-theme="light"] .qcr-best-card.bid .qcr-best-price {
  color: var(--green-700);
}

[data-theme="light"] .qcr-best-card.ask .qcr-best-label,
[data-theme="light"] .qcr-best-card.ask .qcr-best-price {
  color: var(--red-700);
}

[data-theme="light"] .qcr-best-card .qcr-best-side {
  opacity: 0.9;
}

[data-theme="light"] .qcr-best-card .qcr-best-sub {
  color: var(--gray-700);
}

.qcr-best-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
  margin-bottom: 6px;
}

.qcr-best-card.bid .qcr-best-label {
  color: var(--green-400);
}

.qcr-best-card.ask .qcr-best-label {
  color: var(--red-400);
}

.qcr-best-side {
  font-weight: 600;
  letter-spacing: 0.06em;
  opacity: 0.82;
}

.qcr-best-price {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.22;
}

.qcr-best-card.bid .qcr-best-price {
  color: var(--green-400);
}

.qcr-best-card.ask .qcr-best-price {
  color: var(--red-400);
}

.qcr-best-sub {
  font-size: 12px;
  color: var(--text-neutral-secondary);
  margin-top: 4px;
  line-height: 1.35;
}

.qcr-best-exec-btn {
  flex-shrink: 0;
  min-height: 36px;
  min-width: 80px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.03em;
  transition: filter 0.12s ease, opacity 0.12s ease;
}

.qcr-best-exec-btn:hover {
  filter: brightness(1.08);
}

.qcr-best-exec-btn.sell {
  background: var(--fill-success-solid);
  color: var(--text-on-solid);
}

.qcr-best-exec-btn.buy {
  background: var(--fill-danger-solid);
  color: var(--text-on-solid);
}

.qcr-best-copy {
  flex: 1;
  min-width: 0;
}

/* ── LP QUOTE CARDS ── */
.qcr-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* No header row needed — layout is card-based */
.qcr-header { display: none; }

.qcr-row {
  background: var(--fill-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.12s ease;
  container-type: inline-size;
  container-name: qcr-row;
}

@container qcr-row (max-width: 200px) {
  .qcr-actions:not(.single) {
    grid-template-columns: 1fr;
  }
  .qcr-actions:not(.single) .btn-qcr-buy {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
}

.qcr-row.best {
  border-color: var(--border-default);
}

/* Card header: LP name + BEST badge */
.qcr-lp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  box-sizing: border-box;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.qcr-lp-name {
  font-size: var(--font-size-caption);
  font-weight: 700;
  color: var(--text-neutral-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Best-price flags in LP rows (compact chip) */
.qcr-lp-info .risk-badge {
  margin-bottom: 0;
}

/* Action row: two side-by-side execution buttons */
.qcr-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 64px;
}

.qcr-actions.single {
  grid-template-columns: 1fr;
}

.qcr-no-price {
  min-height: 64px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  font-size: 12px;
  color: var(--text-neutral-tertiary);
  border-top: none;
}

/* Execution buttons with price embedded */
.btn-qcr {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  box-sizing: border-box;
  padding: 8px 4px;
  cursor: pointer;
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  border: none;
  transition: filter 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.btn-qcr:active {
  opacity: 0.75;
}

.btn-qcr-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

.btn-qcr-price {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.btn-qcr-usd {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.65;
  line-height: 1.2;
  font-family: var(--font-mono);
}

/* Default: neutral well + semantic price color; tint fill only on best */
.btn-qcr-buy {
  background: transparent;
  color: var(--text-success);
  border-right: 1px solid var(--border-subtle);
}

.btn-qcr-sell {
  background: transparent;
  color: var(--text-danger);
}

.btn-qcr-buy:hover:not(:disabled),
.btn-qcr-sell:hover:not(:disabled) {
  filter: none;
  background: var(--gray-alpha-8);
}

/* Best: tinted well + high-contrast semantic text (not bright wash) */
.btn-qcr-buy.best {
  background: var(--fill-success-subtle);
  color: var(--green-400);
}

.btn-qcr-sell.best {
  background: var(--fill-danger-subtle);
  color: var(--red-400);
}

.btn-qcr-buy.best .btn-qcr-label,
.btn-qcr-buy.best .btn-qcr-price,
.btn-qcr-buy.best .btn-qcr-usd,
.btn-qcr-sell.best .btn-qcr-label,
.btn-qcr-sell.best .btn-qcr-price,
.btn-qcr-sell.best .btn-qcr-usd {
  color: inherit;
}

.btn-qcr-buy.best .btn-qcr-usd,
.btn-qcr-sell.best .btn-qcr-usd {
  opacity: 0.88;
}

.btn-qcr-buy.best:hover:not(:disabled) {
  filter: none;
  background: var(--fill-success-subtle-hover);
}

.btn-qcr-sell.best:hover:not(:disabled) {
  filter: none;
  background: var(--fill-danger-subtle-hover);
}

[data-theme="light"] .btn-qcr-buy.best {
  background: oklch(94% 0.035 155);
  color: var(--green-600);
}

[data-theme="light"] .btn-qcr-sell.best {
  background: oklch(95% 0.03 25);
  color: var(--red-600);
}

[data-theme="light"] .btn-qcr-buy:not(.best) {
  color: var(--green-600);
}

[data-theme="light"] .btn-qcr-sell:not(.best) {
  color: var(--red-600);
}

[data-theme="light"] .btn-qcr-buy.best .btn-qcr-usd,
[data-theme="light"] .btn-qcr-sell.best .btn-qcr-usd,
[data-theme="light"] .btn-qcr-buy:not(.best) .btn-qcr-usd,
[data-theme="light"] .btn-qcr-sell:not(.best) .btn-qcr-usd {
  opacity: 0.78;
}

[data-theme="light"] .btn-qcr-buy.best:hover:not(:disabled) {
  background: oklch(91% 0.045 155);
}

[data-theme="light"] .btn-qcr-sell.best:hover:not(:disabled) {
  background: oklch(92% 0.04 25);
}

.rfq-form-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rfq-extended-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: var(--font-size-caption);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-neutral-tertiary);
  letter-spacing: 0.02em;
}

.input-nb {
  background: var(--fill-input);
  border: 1px solid var(--border-default);
  color: var(--text-neutral-primary);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: var(--font-size-body-sm);
  outline: none;
  font-family: inherit;
  width: 100%;
  transition: all 0.15s ease;
}

.select-nb {
  background: var(--fill-input);
  border: 1px solid var(--border-default);
  color: var(--text-neutral-primary);
  padding: 6px 28px 6px 10px;
  border-radius: 4px;
  font-size: var(--font-size-body-sm);
  outline: none;
  font-family: inherit;
  width: 100%;
  transition: all 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239FA79C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 11px;
  cursor: pointer;
}

.select-nb:focus, .input-nb:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px var(--border-strong);
}

/* Direction: single trough, transparent segments (not nested buttons) */
.direction-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
  background: var(--gray-alpha-8);
  border: none;
  border-radius: 4px;
}

[data-theme="light"] .direction-tabs {
  background: var(--gray-alpha-8);
  border: 1px solid var(--border-subtle);
}

.dir-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-neutral-secondary);
  font-size: var(--font-size-body-sm);
  font-weight: 600;
  min-height: 36px;
  padding: 10px 8px;
  cursor: pointer;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  transition: color 0.15s, background 0.15s;
}

.dir-tab::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gray-alpha-16);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.dir-tab:hover::after {
  opacity: 1;
}

.dir-tab:active::after {
  background: var(--gray-alpha-24);
  opacity: 1;
}

.dir-tab.active {
  background: var(--gray-alpha-16);
  color: var(--text-neutral-primary);
}

.dir-tab.active::after {
  opacity: 0;
}

/* Dir-tab active colors by side */
/* ── RFQ panel side theming (class applied by setSide() to .rfq-ticket-panel) ── */
.rfq-ticket-panel.side-buy .dir-tab.active { color: var(--color-bid-text); background: var(--fill-success-subtle); }
.rfq-ticket-panel.side-sell .dir-tab.active { color: var(--color-ask-text); background: var(--fill-danger-subtle); }
.rfq-ticket-panel.side-two-way .dir-tab.active { color: var(--text-info); background: var(--fill-info-subtle); }

[data-theme="light"] .rfq-ticket-panel.side-buy .dir-tab.active {
  background: oklch(86% 0.08 155);
  color: oklch(32% 0.10 155);
}
[data-theme="light"] .rfq-ticket-panel.side-sell .dir-tab.active {
  background: oklch(90% 0.06 25);
  color: oklch(36% 0.18 25);
}
[data-theme="light"] .rfq-ticket-panel.side-two-way .dir-tab.active {
  background: oklch(89% 0.06 250);
  color: oklch(36% 0.16 250);
}

/* Submit button color follows direction */
.rfq-ticket-panel.side-buy .rfq-submit,
.rfq-ticket-panel.side-buy button[onclick*="sendRFQ"] {
  background: var(--fill-success-solid) !important;
}
.rfq-ticket-panel.side-sell .rfq-submit,
.rfq-ticket-panel.side-sell button[onclick*="sendRFQ"] {
  background: var(--fill-danger-solid) !important;
}
.rfq-ticket-panel.side-two-way .rfq-submit,
.rfq-ticket-panel.side-two-way button[onclick*="sendRFQ"] {
  background: var(--fill-info-solid) !important;
  color: var(--text-on-solid) !important;
}

.rfq-ticket-panel .rfq-submit.btn-primary {
  border: none;
  box-shadow: none;
  background-image: none;
}

/* LP checklist: checked accent follows side */
.rfq-ticket-panel.side-buy .lp-option:has(input:checked) {
  border-color: var(--green-700);
  background: var(--fill-success-subtle);
  color: var(--text-success);
}
.rfq-ticket-panel.side-sell .lp-option:has(input:checked) {
  border-color: var(--red-700);
  background: var(--fill-danger-subtle);
  color: var(--text-danger);
}
.rfq-ticket-panel.side-two-way .lp-option:has(input:checked) {
  border-color: var(--blue-700);
  background: var(--fill-info-subtle);
  color: var(--text-info);
}

/* LP checkbox accent-color per side (buy=green, sell=red always) */
.rfq-ticket-panel.side-buy .lp-option input[type="checkbox"] { accent-color: var(--green-500); }
.rfq-ticket-panel.side-sell .lp-option input[type="checkbox"] { accent-color: var(--red-500); }
.rfq-ticket-panel.side-two-way .lp-option input[type="checkbox"] { accent-color: var(--blue-500); }


/* LP Grid Checklist */
.lp-checklist {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  background: var(--fill-surface-raised);
  padding: 8px;
  border-radius: 2px;
}

.lp-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--font-size-body-sm);
  color: var(--text-neutral-secondary);
  padding: 6px 10px;
  border-radius: 2px;
  border: 1px solid transparent;
  background: var(--fill-surface);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
}
.lp-option:has(input:checked) { border-color: var(--border-strong); }

.lp-option::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gray-alpha-8);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.lp-option:hover::after {
  opacity: 1;
}

.lp-option:active::after {
  background: var(--gray-alpha-24);
  opacity: 1;
}

.lp-option:has(input:checked) {
  border-color: var(--border-strong);
  background: var(--fill-surface-overlay);
  color: var(--text-neutral-primary);
}

.lp-option input[type="checkbox"] {
  accent-color: var(--text-neutral-primary);
  cursor: pointer;
  width: 12px;
  height: 12px;
  margin: 0;
}

/* Countdown bar */
.timer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
  margin-top: 4px;
}

.timer-bar-bg {
  flex: 1;
  height: 2px;
  background: var(--border-subtle);
  margin-left: 8px;
  position: relative;
  overflow: hidden;
}

.timer-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: var(--text-neutral-secondary);
}

/* RFQ progress bar (below button) */
.rfq-progress-wrap {
  height: 3px;
  background: var(--border-subtle);
  border-radius: 99px;
  overflow: hidden;
}

.rfq-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--text-neutral-primary);
  border-radius: 99px;
  transition: width 1s linear;
}

/* Expired state */
.rfq-expired-state {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rfq-expired-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: var(--font-size-caption);
  color: var(--text-neutral-tertiary);
  padding: 6px 0 2px;
}

/* ── REFINED SEMANTIC BADGES & NOTICE BOXES ── */
.badge-nb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-caption);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 2px;
  text-transform: uppercase;
}

.badge-nb.badge-success {
  background: var(--fill-success-subtle);
  color: var(--text-success);
  border: 1px solid var(--border-success);
}

.badge-nb.badge-warning {
  background: var(--fill-warning-subtle);
  color: var(--text-warning);
  border: 1px solid var(--border-warning);
}

.badge-nb.badge-danger {
  background: var(--fill-danger-subtle);
  color: var(--text-danger);
  border: 1px solid var(--border-danger);
}

.badge-nb.badge-info {
  background: var(--fill-info-subtle);
  color: var(--text-info);
  border: 1px solid var(--border-info);
}

.badge-nb.badge-accent {
  background: var(--fill-accent-subtle);
  color: var(--text-accent);
  border: 1px solid var(--border-accent);
}

/* ── SYSTEM NOTICES ── */
.notice-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 2px;
}

.notice-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 8px;
  border-radius: 2px;
  font-size: var(--font-size-caption);
  animation: notice-in 0.18s ease;
}

@keyframes notice-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notice-item.notice-warning {
  background: var(--fill-warning-subtle);
  border: 1px solid oklch(55% 0.12 83 / 0.18);
}

.notice-item.notice-info {
  background: var(--fill-info-subtle);
  border: 1px solid oklch(55% 0.12 240 / 0.18);
}

.notice-item.notice-danger {
  background: var(--fill-danger-subtle);
  border: 1px solid oklch(55% 0.12 25 / 0.18);
}

.notice-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.notice-warning .notice-icon { color: var(--text-warning); }
.notice-info    .notice-icon { color: var(--text-info); }
.notice-danger  .notice-icon { color: var(--text-danger); }

.notice-body {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.notice-time {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  color: var(--text-neutral-tertiary);
  font-weight: 500;
}

.notice-msg {
  color: var(--text-neutral-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notice-warning .notice-msg { color: var(--text-warning); }
.notice-info    .notice-msg { color: var(--text-neutral-secondary); }
.notice-danger  .notice-msg { color: var(--text-danger); }

.notice-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-neutral-disabled);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  display: flex;
  align-items: center;
  font-size: 13px;
  transition: color 0.12s ease;
}

.notice-dismiss:hover { color: var(--text-neutral-secondary); }

/* ── ICON ── */
.lucide {
  width: 12px;
  height: 12px;
  stroke-width: 2px;
  display: inline-block;
  vertical-align: -2px; /* optical baseline shift */
}

/* ── Reduced-motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .notice-slide-in,
  .rfq-progress-bar { animation: none !important; }
}
