/* ==========================================================================
   Order Flow Momentum Engine — page styles
   Every selector is namespaced with .of-* so nothing here can leak into the
   correlation dashboard. Theme tokens come from styles.css.
   ========================================================================== */

.of-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 6px clamp(14px, 4vw, 44px) 44px;
  display: grid;
  gap: 16px;
}

.of-panel {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: var(--shadow);
  padding: clamp(14px, 2.2vw, 22px);
}

.of-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.55), rgba(168, 85, 247, 0.5), transparent);
  pointer-events: none;
}

.of-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 18px;
  margin-bottom: 12px;
}

.of-panel-head h2 {
  font-size: 0.98rem;
}

.of-panel-head .hint {
  margin-top: 0;
}

.of-doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.of-doc-actions .btn {
  padding: 7px 12px;
  font-size: 0.76rem;
}

/* ------------------------------- controls -------------------------------- */

.of-controls-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.of-pair {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 172px;
}

.of-pair-label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.of-pair strong {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(100deg, var(--text) 12%, var(--cyan) 68%, var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.of-pair-sub {
  font-size: 0.7rem;
  color: var(--muted);
}

.of-search {
  display: flex;
  align-items: center;
  flex: 1 1 300px;
  max-width: 460px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.of-search:focus-within {
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12);
}

.of-search-prefix,
.of-search-suffix {
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}

.of-search input {
  flex: 1 1 auto;
  min-width: 58px;
  padding: 8px 2px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.of-search input::placeholder {
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.of-search .btn {
  padding: 8px 16px;
  border-radius: 999px;
}

.of-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.of-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 9px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-strong);
}

.of-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  font-size: 0.71rem;
  color: var(--muted);
  white-space: nowrap;
}

.of-meta b {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.of-meta.is-live b {
  color: var(--pos);
}

.of-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16);
  animation: pulse 1.8s ease-in-out infinite;
}

/* The shared status pill has no "paused" state in styles.css. */
.status-pill[data-state="paused"] {
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.42);
}

.status-pill[data-state="paused"] .dot {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.16);
}

/* ------------------------------ timeframes ------------------------------- */

.of-tf-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.of-tf {
  display: flex;
  flex: 1 1 108px;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 8px 11px 9px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.of-tf:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.5);
}

.of-tf:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.of-tf-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.of-tf-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.of-tf-pct {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.of-tf-net {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.of-tf-track {
  display: block;
  height: 3px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.of-tf-track > i {
  display: block;
  height: 100%;
  width: var(--fill, 50%);
  border-radius: 999px;
  background: var(--tone, var(--pos));
  transition: width 0.28s ease, background 0.28s ease;
}

.of-tf.is-off {
  opacity: 0.4;
}

.of-tf.is-off .of-tf-pct {
  color: var(--muted);
}

.of-tf-combined {
  flex: 1 1 218px;
  border-color: rgba(34, 211, 238, 0.42);
  background: linear-gradient(120deg, rgba(34, 211, 238, 0.14), rgba(168, 85, 247, 0.16));
  cursor: default;
  box-shadow: 0 12px 30px -22px rgba(34, 211, 238, 0.9);
}

.of-tf-combined:hover {
  transform: none;
  border-color: rgba(34, 211, 238, 0.55);
}

.of-tf-combined .of-tf-label {
  color: var(--text);
}

.of-tf-hint {
  margin-top: 10px;
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--muted);
}

.of-tf-hint strong {
  color: var(--text);
}

/* ----------------------------- auto refresh ------------------------------ */

.of-ar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.of-ar-label {
  margin-right: 2px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.of-ar-pill {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.of-ar-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.5);
  color: var(--text);
}

.of-ar-pill[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(34, 211, 238, 0.55);
  background: linear-gradient(120deg, rgba(34, 211, 238, 0.26), rgba(168, 85, 247, 0.28));
  box-shadow: 0 8px 22px -16px rgba(34, 211, 238, 0.9);
}

.of-ar-note {
  margin-top: 9px;
  font-size: 0.73rem;
  line-height: 1.6;
  color: var(--muted);
}

/* ------------------------------ metric cards ----------------------------- */

.of-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(236px, 1fr));
  gap: 14px;
}

.of-card {
  position: relative;
  overflow: hidden;
  padding: 16px 17px 15px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow);
}

.of-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--card-accent, linear-gradient(90deg, var(--cyan), var(--purple)));
}

.of-card::after {
  content: "";
  position: absolute;
  right: -28%;
  bottom: -58%;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--card-glow, rgba(34, 211, 238, 0.16)), transparent 66%);
  pointer-events: none;
}

.of-card[data-tone="buy"] {
  --card-accent: linear-gradient(90deg, #22c55e, #22d3ee);
  --card-glow: rgba(34, 197, 94, 0.22);
}

.of-card[data-tone="sell"] {
  --card-accent: linear-gradient(90deg, #ef4444, #a855f7);
  --card-glow: rgba(239, 68, 68, 0.2);
}

.of-card > * {
  position: relative;
  z-index: 1;
}

.of-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.of-card-head h2 {
  font-size: 0.87rem;
  font-weight: 700;
}

.of-card-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  background: rgba(34, 211, 238, 0.14);
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 800;
}

.of-card[data-tone="buy"] .of-card-icon {
  border-color: rgba(34, 197, 94, 0.32);
  background: rgba(34, 197, 94, 0.15);
  color: var(--pos);
}

.of-card[data-tone="sell"] .of-card-icon {
  border-color: rgba(239, 68, 68, 0.32);
  background: rgba(239, 68, 68, 0.15);
  color: var(--neg);
}

.of-card-tag {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.of-gauge {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.of-gauge > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.7), var(--pos));
  transition: width 0.3s ease, background 0.3s ease;
}

.of-gauge > i.is-sell {
  background: linear-gradient(90deg, var(--neg), rgba(239, 68, 68, 0.65));
}

.of-gauge::after {
  content: "";
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 50%;
  width: 1px;
  background: var(--border-strong);
}

.of-big {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 12px 0 11px;
  font-family: var(--mono);
  font-size: 1.36rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.of-big small {
  font-family: var(--font);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.of-card[data-tone="buy"] .of-big {
  color: var(--pos);
}

.of-card[data-tone="sell"] .of-big {
  color: var(--neg);
}

.of-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.of-stat {
  min-width: 0;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
}

.of-stat dt {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.of-stat dd {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.of-stat.is-buy dd {
  color: var(--pos);
}

.of-stat.is-sell dd {
  color: var(--neg);
}

/* -------------------------------- live tape ------------------------------ */

.of-tape {
  padding: 0;
  overflow: hidden;
}

.of-tape-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: clamp(14px, 2.2vw, 20px) clamp(14px, 2.2vw, 22px) 12px;
}

.of-tape-head h2 {
  font-size: 0.98rem;
}

.of-tape-head .hint {
  margin-top: 2px;
}

.of-pulse {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.of-pulse i {
  width: 5px;
  height: 15px;
  border-radius: 2px;
  background: var(--track);
  transition: background 0.2s ease, height 0.2s ease;
}

.of-pulse i.is-buy {
  background: var(--pos);
}

.of-pulse i.is-sell {
  background: var(--neg);
}

.of-pulse i.is-whale {
  height: 22px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.of-tape-wrap {
  max-height: 430px;
  overflow: auto;
  border-top: 1px solid var(--border);
}

.of-tape table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.of-tape thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--card-strong);
  backdrop-filter: blur(14px);
  text-align: left;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.of-tape thead th.num,
.of-tape tbody td.num {
  text-align: right;
}

.of-tape tbody td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.77rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.of-tape tbody tr:nth-child(even) td {
  background: rgba(148, 163, 208, 0.04);
}

.of-tape tbody tr:hover td {
  background: var(--card-hover);
}

.of-tape thead th:last-child,
.of-tape tbody td:last-child {
  padding-right: 22px;
}

.of-tape-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.of-tape-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 208, 0.35);
}

.of-time {
  color: var(--muted);
}

.of-ex {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.of-ex i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ex-color, var(--cyan));
  box-shadow: 0 0 0 3px rgba(148, 163, 208, 0.12);
}

.of-side {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.of-side.is-buy {
  color: var(--pos);
}

.of-side.is-sell {
  color: var(--neg);
}

.of-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid;
  font-family: var(--font);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.of-badge.is-spot {
  border-color: rgba(34, 211, 238, 0.34);
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan);
}

.of-badge.is-fut {
  border-color: rgba(168, 85, 247, 0.36);
  background: rgba(168, 85, 247, 0.14);
  color: #c084fc;
}

[data-theme="light"] .of-badge.is-fut {
  color: #7e22ce;
}

.of-amt {
  font-weight: 700;
  color: var(--text);
}

.of-amt.is-whale {
  color: var(--warn);
}

.of-whale {
  margin-left: 5px;
  font-size: 0.72rem;
}

.of-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 40px 20px;
  text-align: center;
}

.of-empty[hidden] {
  display: none;
}

.of-empty strong {
  font-size: 0.95rem;
}

.of-empty p {
  max-width: 52ch;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--muted);
}

@keyframes ofFlashBuy {
  from { background: rgba(34, 197, 94, 0.16); }
  to { background: transparent; }
}

@keyframes ofFlashSell {
  from { background: rgba(239, 68, 68, 0.16); }
  to { background: transparent; }
}

.of-tape tbody tr.is-new-buy td {
  animation: ofFlashBuy 0.5s ease-out;
}

.of-tape tbody tr.is-new-sell td {
  animation: ofFlashSell 0.5s ease-out;
}

/* --------------------------------- toast --------------------------------- */

.of-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  padding: 10px 17px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.42);
  background: var(--card-strong);
  backdrop-filter: blur(18px);
  color: var(--text);
  font-size: 0.79rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.of-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------- docs sub-navigation --------------------------- */

/* Shared by the Order Flow and Correlation Radar doc pages (pages.css). */

/* ------------------------------- responsive ------------------------------ */

@media (max-width: 860px) {
  .of-actions {
    margin-left: 0;
    width: 100%;
  }

  .of-actions .btn {
    flex: 1 1 auto;
  }

  .of-tf-combined {
    flex-basis: 100%;
  }
}

@media (max-width: 560px) {
  .of-pair {
    min-width: 100%;
  }

  .of-search {
    max-width: none;
    flex-basis: 100%;
  }

  .of-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .of-tf:not(.of-tf-combined) {
    flex-basis: calc(50% - 4px);
  }

  .of-pulse {
    margin-left: 0;
  }

  .of-tape-wrap {
    max-height: 360px;
  }
}

.of-split {
  display: flex;
  height: 5px;
  margin-top: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--track);
}

.of-split > i {
  height: 100%;
  transition: width 0.3s ease;
}

.of-split .is-buy {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.7), var(--pos));
}

.of-split .is-sell {
  background: linear-gradient(90deg, var(--neg), rgba(239, 68, 68, 0.6));
}

