:root {
  color: #edf3fb;
  background: #070b12;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #070b12;
  --surface: #101722;
  --surface-raised: #151e2b;
  --surface-soft: #0c121c;
  --surface-glass: rgb(16 23 34 / 0.9);
  --line: #293445;
  --line-strong: #435168;
  --text: #edf3fb;
  --muted: #aeb9c7;
  --dim: #778496;
  --focus: #63b3ff;
  --long: #3bd78b;
  --short: #ff647c;
  --take-profit: #5eafff;
  --stop-out: #ff9f4a;
  --anticipate-long: #f4cf4f;
  --anticipate-short: #c792ea;
  --wait: #8994a5;
  --unavailable: #c5d0dc;
  --shadow: rgb(0 0 0 / 0.38);
  --radius: 1rem;
}

html[data-font-size="18"] { font-size: 18px; }
html[data-font-size="19"] { font-size: 19px; }
html[data-font-size="20"] { font-size: 20px; }
html[data-font-size="21"] { font-size: 21px; }
html[data-font-size="22"] { font-size: 22px; }
html[data-font-size="23"] { font-size: 23px; }
html[data-font-size="24"] { font-size: 24px; }
html[data-font-size="25"] { font-size: 25px; }
html[data-font-size="26"] { font-size: 26px; }
html[data-font-size="27"] { font-size: 27px; }
html[data-font-size="28"] { font-size: 28px; }

*,
*::before,
*::after { box-sizing: border-box; }

html { min-width: 320px; min-height: 100%; background: var(--bg); }

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 70% -12rem, rgb(45 96 145 / 0.3), transparent 36rem),
    radial-gradient(circle at 5% 28%, rgb(39 87 93 / 0.16), transparent 28rem),
    var(--bg);
}

button,
input,
select { font: inherit; }

button,
select,
summary { min-height: 2.75rem; }

button,
summary,
select,
input[type="range"],
input[type="checkbox"] { cursor: pointer; }

button:disabled { cursor: not-allowed; opacity: 0.6; }

:focus-visible {
  outline: 0.17rem solid var(--focus);
  outline-offset: 0.16rem;
}

[hidden] { display: none !important; }

.ambient-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.22;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(99 179 255 / 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgb(99 179 255 / 0.04) 1px, transparent 1px);
  background-size: 3.2rem 3.2rem;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

.centered-view,
.auth-view {
  min-height: 100vh;
  min-height: 100svh;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.centered-view {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.loading-orbit {
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 2.5rem rgb(99 179 255 / 0.13);
  animation: loading-pulse 1.4s ease-in-out infinite;
}

.loading-orbit span {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: var(--long);
  box-shadow: 0 0 1rem rgb(59 215 139 / 0.6);
}

@keyframes loading-pulse {
  50% { transform: scale(1.08); box-shadow: 0 0 3rem rgb(99 179 255 / 0.25); }
}

.auth-view { display: grid; place-items: center; }

.login-card {
  width: min(100%, 31rem);
  padding: clamp(1.35rem, 6vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 1.45rem;
  background: rgb(16 23 34 / 0.97);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.05) inset, 0 2rem 5rem var(--shadow);
}

.brand-lockup,
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.brand-paw { font-size: 1.15rem; filter: grayscale(1) brightness(1.8); }

.eyebrow {
  margin: 0;
  color: #afd7fb;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  line-height: 1.35;
  text-transform: uppercase;
}

.login-card .eyebrow { margin-top: 3.25rem; }

.login-card h1 {
  max-width: 12ch;
  margin: 0.75rem 0 0;
  font-size: clamp(2rem, 8vw, 3.35rem);
  line-height: 1;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.login-intro {
  margin: 1.15rem 0 2rem;
  color: var(--muted);
  line-height: 1.55;
}

.field-group { display: block; }
.field-group + .field-group { margin-top: 1.1rem; }
.field-group > span:first-child { display: block; margin-bottom: 0.45rem; color: #d8e1ed; font-size: 0.82rem; font-weight: 800; }

.field-group input {
  width: 100%;
  min-height: 3.15rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.72rem;
  color: var(--text);
  background: var(--surface-soft);
  caret-color: var(--focus);
}

.field-group input:hover { border-color: #687a92; }
.field-group input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 1000px var(--surface-soft) inset; }

.password-field { position: relative; display: block; }
.password-field input { padding-right: 4.4rem; }

.field-action {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  min-height: 2.3rem;
  padding: 0.3rem 0.55rem;
  border: 0;
  border-radius: 0.45rem;
  color: #d4dfec;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 800;
  transform: translateY(-50%);
}

.field-action:hover { background: rgb(255 255 255 / 0.08); }

.form-error {
  margin: 0.85rem 0 0;
  color: #ff8b9d;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.4;
}

.primary-button,
.scan-button,
.secondary-button {
  border-radius: 0.72rem;
  font-weight: 900;
}

.primary-button {
  width: 100%;
  min-height: 3.2rem;
  margin-top: 1.3rem;
  border: 1px solid #a0d3ff;
  color: #06101b;
  background: #79beff;
  box-shadow: 0 0.45rem 1.5rem rgb(26 111 181 / 0.22);
}

.primary-button:hover { background: #a1d3ff; }

.skip-link {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.75rem, env(safe-area-inset-left));
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: 0.6rem;
  color: #071018;
  background: var(--focus);
  font-weight: 850;
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.dashboard-shell {
  width: min(100%, 104rem);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(0.55rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  min-height: 3.65rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  padding: 0.2rem 0 0.55rem;
  border-bottom: 1px solid var(--line);
}

.topbar-brand strong { color: #a8d7ff; }

.paper-chip {
  padding: 0.27rem 0.4rem;
  border: 1px solid #607288;
  border-radius: 0.3rem;
  color: #bac7d6;
  font-size: 0.52rem;
  letter-spacing: 0.09em;
}

.topbar-actions { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.3rem; }

.compact-health,
.route-badge {
  display: inline-flex;
  min-height: 2.2rem;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c7d2df;
  background: rgb(16 23 34 / 0.84);
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
}

.compact-health i,
.route-badge i {
  width: 0.48rem;
  height: 0.48rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--wait);
}

.status-online i,
.route-ready i { background: var(--long); box-shadow: 0 0 0.7rem rgb(59 215 139 / 0.5); }
.status-running i,
.route-dry i { background: var(--anticipate-long); box-shadow: 0 0 0.7rem rgb(244 207 79 / 0.45); }
.status-error i,
.route-error i { background: var(--short); box-shadow: 0 0 0.7rem rgb(255 100 124 / 0.45); }

.text-button {
  min-height: 2.75rem;
  padding: 0.4rem 0.55rem;
  border: 0;
  border-radius: 0.5rem;
  color: #c7d2e0;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: #586575;
  text-underline-offset: 0.24em;
}

.text-button:hover { color: #fff; background: rgb(255 255 255 / 0.065); }

.icon-button {
  display: inline-grid;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.55rem;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 0.65rem;
  color: var(--text);
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 850;
}

.icon-button:hover { border-color: #63758c; background: var(--surface-raised); }

.dashboard-main { padding-top: clamp(1rem, 3vw, 2.2rem); }

.cat-masthead {
  position: relative;
  min-height: clamp(15rem, 31vw, 24rem);
  margin-bottom: clamp(1.5rem, 4vw, 3rem);
  overflow: hidden;
  container-type: inline-size;
  border: 1px solid #43536b;
  border-radius: clamp(1rem, 2.5vw, 1.6rem);
  background:
    linear-gradient(90deg, rgb(3 8 15 / 0.9) 0 34%, rgb(3 8 15 / 0.26) 62%, rgb(3 8 15 / 0.58) 100%),
    radial-gradient(circle at 75% 30%, rgb(93 167 228 / 0.2), transparent 30%),
    linear-gradient(160deg, #111c2a, #070b12 70%);
  box-shadow: 0 1.4rem 4rem rgb(0 0 0 / 0.48), 0 0 3rem rgb(80 161 230 / 0.11);
  isolation: isolate;
}

.cat-masthead::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.32;
  background-image: repeating-linear-gradient(90deg, transparent 0 4rem, rgb(115 183 238 / 0.09) 4rem calc(4rem + 1px));
  content: "";
}

.masthead-copy {
  position: relative;
  z-index: 3;
  display: grid;
  width: min(43%, 38rem);
  min-height: clamp(15rem, 31vw, 24rem);
  align-content: center;
  gap: 0.65rem;
  padding: clamp(1.1rem, 4vw, 3.5rem);
  pointer-events: none;
  text-shadow: 0 0.15rem 0.8rem rgb(0 0 0 / 0.9);
}

.masthead-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.94;
  letter-spacing: -0.06em;
}

.masthead-copy h1 span { color: #9eb0c3; font-weight: 520; }
.masthead-copy > p:last-child { max-width: 34rem; margin: 0.35rem 0 0; color: #c4d0de; font-size: 0.82rem; font-weight: 720; line-height: 1.5; }

.cat-track {
  position: absolute;
  inset: 0.5rem 0.8rem 1.6rem;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.cat-patrol {
  position: absolute;
  bottom: 0;
  left: 0;
  width: clamp(15rem, 34cqw, 32rem);
  transform: translateX(0);
  animation: cat-patrol-track 17s linear infinite;
  will-change: transform;
}

.cat-facing {
  transform: scaleX(1);
  transform-origin: center;
  animation: cat-direction 17s linear infinite;
}

.cat-image {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 1.1rem 0.8rem rgb(0 0 0 / 0.55));
  animation: cat-bob 0.72s ease-in-out infinite;
}

.masthead-floor {
  position: absolute;
  right: 1rem;
  bottom: 1.25rem;
  left: 1rem;
  z-index: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #60778e 12% 88%, transparent);
  box-shadow: 0 0.2rem 0.8rem rgb(0 0 0 / 0.9);
}

@keyframes cat-patrol-track {
  0%, 3% { transform: translateX(0); }
  47%, 50% { transform: translateX(calc(100cqw - 100% - 1.6rem)); }
  94%, 100% { transform: translateX(0); }
}

@keyframes cat-direction {
  0%, 49.4% { transform: scaleX(1); }
  50%, 96.5% { transform: scaleX(-1); }
  97%, 100% { transform: scaleX(1); }
}

@keyframes cat-bob {
  50% { transform: translateY(-0.18rem) rotate(-0.2deg); }
}

html[data-mascot-motion="off"] .cat-patrol,
html[data-mascot-motion="off"] .cat-facing,
html[data-mascot-motion="off"] .cat-image {
  animation: none;
}

html[data-mascot-motion="off"] .cat-patrol { transform: translateX(calc(100cqw - 100% - 2rem)); }

html.page-hidden .cat-patrol,
html.page-hidden .cat-facing,
html.page-hidden .cat-image {
  animation-play-state: paused;
}

.scanner-section,
.trades-section {
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: linear-gradient(145deg, rgb(16 23 34 / 0.95), rgb(8 13 21 / 0.97));
  box-shadow: 0 1.2rem 3.5rem rgb(0 0 0 / 0.22);
}

.scanner-section { padding: clamp(1rem, 3vw, 2.1rem); }

.scanner-header {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.2rem 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.scanner-header > div:first-child { min-width: 0; }
.scanner-header h2,
.section-header h2,
.method-strip h2 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.75rem, 4.5vw, 3.3rem);
  line-height: 1;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.scanner-disclosure,
.section-header > div > p:last-child {
  max-width: 50rem;
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.scan-controls { display: flex; flex: 0 0 auto; align-items: stretch; gap: 0.6rem; }

.scanner-health-card {
  display: flex;
  min-width: 14rem;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.75rem;
  background: var(--surface-soft);
}

.health-dot {
  width: 0.6rem;
  height: 0.6rem;
  flex: 0 0 auto;
  margin-top: 0.28rem;
  border-radius: 50%;
  background: var(--wait);
}

.health-dot.online { background: var(--long); box-shadow: 0 0 0.9rem rgb(59 215 139 / 0.55); }
.health-dot.running { background: var(--anticipate-long); box-shadow: 0 0 0.9rem rgb(244 207 79 / 0.5); animation: dot-pulse 0.9s ease-in-out infinite; }
.health-dot.error { background: var(--short); box-shadow: 0 0 0.9rem rgb(255 100 124 / 0.5); }
.health-dot.stale { background: var(--stop-out); box-shadow: 0 0 0.9rem rgb(255 159 74 / 0.45); }

@keyframes dot-pulse { 50% { opacity: 0.45; transform: scale(0.82); } }

.scanner-health-card div { display: grid; gap: 0.18rem; }
.scanner-health-card strong { font-size: 0.68rem; letter-spacing: 0.11em; }
.scanner-health-card span { color: var(--muted); font-size: 0.62rem; line-height: 1.35; }

.scan-button {
  display: inline-flex;
  min-width: 8.3rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid #83bded;
  color: #071018;
  background: #77baf2;
}

.scan-button:hover { background: #9acdf7; }
.scan-button.running #scan-button-icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.scanner-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.85rem 0;
}

.scanner-meta > p { margin: 0; color: #bdc8d5; font-size: 0.72rem; font-weight: 720; line-height: 1.45; }
.route-statuses { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.signal-summary {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.summary-chip {
  display: flex;
  min-width: 0;
  min-height: 3.4rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  color: #c4cfdb;
  background: var(--surface-soft);
  font-size: 0.68rem;
  font-weight: 800;
}

.summary-chip strong { font-size: 0.92rem; }
.summary-chip:hover { border-color: #5a6c83; background: var(--surface-raised); }
.summary-chip.selected { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus) inset; color: #fff; }
.summary-chip.signal-long strong { color: var(--long); }
.summary-chip.signal-short strong { color: var(--short); }
.summary-chip.signal-anticipate strong { color: var(--anticipate-long); }
.summary-chip.signal-exit strong { color: var(--stop-out); }
.summary-chip.signal-wait strong { color: var(--wait); }
.summary-chip.signal-unavailable strong { color: var(--unavailable); }

.matrix-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1rem;
  margin: 0 0 0.65rem;
}

.stage-legend { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.stage-chip,
.stage-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: 1px solid currentColor;
  border-radius: 0.45rem;
  font-size: 0.6rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.stage-chip { min-height: 2rem; padding: 0.3rem 0.45rem; }
.stage-chip b { font-weight: 700; }
.stage-1 { color: #76baff; background: rgb(94 175 255 / 0.09); }
.stage-2 { color: var(--long); background: rgb(59 215 139 / 0.08); }
.stage-3 { color: var(--anticipate-long); background: rgb(244 207 79 / 0.08); }
.stage-4 { color: var(--short); background: rgb(255 100 124 / 0.08); }
.stage-transition { color: var(--anticipate-short); background: rgb(199 146 234 / 0.09); }
.stage-unavailable { color: var(--wait); background: rgb(137 148 165 / 0.07); }

.sort-control { display: flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: 0.68rem; font-weight: 800; }
.sort-control select,
.select-field select {
  min-height: 2.5rem;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.6rem;
  color: var(--text);
  background: var(--surface-soft);
}

.table-scroll {
  position: relative;
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  scrollbar-color: #52637a #101722;
}

.scanner-table {
  width: 100%;
  min-width: 78rem;
  border-collapse: separate;
  border-spacing: 0;
  background: rgb(10 16 25 / 0.72);
}

.scanner-table th,
.scanner-table td {
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.scanner-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: #aebbc9;
  background: #121a27;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.scanner-table th small { display: block; margin-top: 0.15rem; color: #748296; font-size: 0.5rem; letter-spacing: 0; text-transform: none; }
.scanner-table th:first-child,
.scanner-table td:first-child { position: sticky; left: 0; z-index: 2; background: #111925; box-shadow: 0.4rem 0 0.8rem rgb(0 0 0 / 0.18); }
.scanner-table th:first-child { z-index: 4; background: #151e2b; }
.scanner-table tr:last-child td { border-bottom: 0; }
.scanner-table tbody tr:hover td { background-color: rgb(32 45 61 / 0.72); }
.scanner-table tbody tr:hover td:first-child { background: #202d3d; }
.scanner-table tr.row-error td { background-image: linear-gradient(90deg, transparent, rgb(255 100 124 / 0.025)); }

.market-name { display: grid; min-width: 7rem; gap: 0.15rem; }
.market-name strong { font-size: 0.88rem; letter-spacing: -0.02em; }
.market-name span { color: var(--muted); font-size: 0.57rem; }

.price-cell { display: grid; gap: 0.13rem; font-variant-numeric: tabular-nums; }
.price-cell strong { font-size: 0.77rem; }
.price-cell small,
.timestamp-cell small { color: var(--muted); font-size: 0.53rem; }

.stage-cell { min-width: 4.45rem; min-height: 2.15rem; padding: 0.34rem 0.38rem; flex-direction: column; white-space: normal; }
.stage-cell small { color: currentColor; font-size: 0.47rem; font-weight: 750; opacity: 0.86; }

.signal-badge {
  display: inline-flex;
  min-width: 5.5rem;
  min-height: 2rem;
  align-items: center;
  justify-content: center;
  padding: 0.33rem 0.48rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.57rem;
  font-weight: 950;
  line-height: 1.05;
  text-align: center;
}

.state-long { color: var(--long); background: rgb(59 215 139 / 0.1); }
.state-short { color: var(--short); background: rgb(255 100 124 / 0.1); }
.state-anticipate-long { color: var(--anticipate-long); background: rgb(244 207 79 / 0.09); }
.state-anticipate-short { color: var(--anticipate-short); background: rgb(199 146 234 / 0.09); }
.state-take-profit { color: var(--take-profit); background: rgb(94 175 255 / 0.09); }
.state-stop-out { color: var(--stop-out); background: rgb(255 159 74 / 0.09); }
.state-wait { color: var(--wait); background: rgb(137 148 165 / 0.08); }
.state-unavailable { border-style: dashed; color: var(--unavailable); background: rgb(197 208 220 / 0.05); }

.level-cell { min-width: 5rem; color: #d7e0ea; font-size: 0.68rem; font-variant-numeric: tabular-nums; }
.level-cell.unavailable { color: var(--dim); }
.timestamp-cell { min-width: 7rem; color: #c1ccd8; font-size: 0.6rem; }

.detail-button {
  min-width: 3.5rem;
  min-height: 2.4rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.55rem;
  color: #dbe7f3;
  background: var(--surface);
  font-size: 0.58rem;
  font-weight: 850;
}
.detail-button:hover { border-color: var(--focus); background: #1b2939; }

.scanner-cards { display: none; gap: 0.75rem; }
.scanner-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 0.32rem solid var(--state-color, var(--wait));
  border-radius: 0.9rem;
  background: rgb(16 23 34 / 0.95);
}
.scanner-card.state-long { --state-color: var(--long); }
.scanner-card.state-short { --state-color: var(--short); }
.scanner-card.state-anticipate-long { --state-color: var(--anticipate-long); }
.scanner-card.state-anticipate-short { --state-color: var(--anticipate-short); }
.scanner-card.state-take-profit { --state-color: var(--take-profit); }
.scanner-card.state-stop-out { --state-color: var(--stop-out); }
.scanner-card.state-unavailable { --state-color: var(--unavailable); }
.scanner-card summary { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.85rem; list-style: none; }
.scanner-card summary::-webkit-details-marker { display: none; }
.scanner-card summary::after { color: var(--muted); content: "+"; font-size: 1.15rem; font-weight: 400; }
.scanner-card[open] summary::after { content: "−"; }
.card-market { display: grid; min-width: 0; gap: 0.15rem; }
.card-market strong { font-size: 1rem; }
.card-market span { color: var(--muted); font-size: 0.63rem; }
.card-body { padding: 0 0.85rem 0.85rem; border-top: 1px solid var(--line); }
.card-stage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; margin: 0.75rem 0; }
.card-stage-grid .stage-cell { width: 100%; }
.card-level-grid,
.detail-level-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.card-level-grid div,
.detail-level-grid div,
.detail-stat { min-width: 0; padding: 0.55rem; border: 1px solid var(--line); border-radius: 0.55rem; background: var(--surface-soft); }
.card-level-grid span,
.detail-level-grid span,
.detail-stat span { display: block; color: var(--muted); font-size: 0.54rem; font-weight: 800; text-transform: uppercase; }
.card-level-grid strong,
.detail-level-grid strong,
.detail-stat strong { display: block; margin-top: 0.25rem; overflow-wrap: anywhere; font-size: 0.73rem; }
.card-reason { margin: 0.75rem 0; color: #bdc8d4; font-size: 0.68rem; line-height: 1.5; }
.card-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.55rem; color: var(--muted); font-size: 0.58rem; }

.empty-state { margin: 0; padding: 1rem; color: var(--muted); line-height: 1.5; }

.trades-section { margin-top: clamp(1.5rem, 4vw, 3rem); padding: clamp(1rem, 3vw, 2.1rem); }
.section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1rem; }

.export-menu { position: relative; flex: 0 0 auto; }
.export-menu summary {
  display: inline-flex;
  min-width: 7.6rem;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  border: 1px solid #7892ad;
  border-radius: 0.68rem;
  color: var(--text);
  background: #1a2635;
  font-size: 0.72rem;
  font-weight: 850;
  list-style: none;
}
.export-menu summary::-webkit-details-marker { display: none; }
.export-menu summary::after { margin-left: 0.5rem; content: "▾"; }
.export-menu[open] summary { border-color: var(--focus); }
.export-menu > div {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 8;
  display: grid;
  width: max-content;
  min-width: 11rem;
  padding: 0.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.65rem;
  background: #182332;
  box-shadow: 0 1rem 2.5rem var(--shadow);
}
.export-menu button { min-height: 2.55rem; padding: 0.45rem 0.6rem; border: 0; border-radius: 0.45rem; color: #dde7f2; background: transparent; font-size: 0.68rem; text-align: left; }
.export-menu button:hover { background: #243346; }

.trade-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.trade-panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 0.95rem; background: rgb(12 18 28 / 0.78); }
.trade-panel > header { display: flex; min-height: 3.8rem; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--line); }
.trade-panel > header > div { display: flex; min-width: 0; align-items: center; gap: 0.6rem; }
.trade-panel h3 { margin: 0; overflow-wrap: anywhere; font-size: 0.98rem; }
.panel-index { color: #7f91a5; font-size: 0.55rem; font-weight: 900; }
.count-badge { display: inline-grid; min-width: 2rem; min-height: 2rem; place-items: center; border-radius: 999px; color: #071018; background: var(--wait); font-size: 0.68rem; font-weight: 900; }
.trade-list { display: grid; }
.trade-card { min-width: 0; padding: 0.85rem; border-bottom: 1px solid var(--line); }
.trade-card:last-child { border-bottom: 0; }
.trade-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.trade-card-head h4 { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 0.88rem; }
.side-badge { flex: 0 0 auto; padding: 0.28rem 0.44rem; border-radius: 0.35rem; color: #071018; font-size: 0.54rem; font-weight: 950; }
.side-long { background: var(--long); }
.side-short { background: var(--short); }
.trade-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; margin: 0.8rem 0; }
.trade-metrics div { min-width: 0; }
.trade-metrics dt { color: var(--muted); font-size: 0.52rem; font-weight: 800; text-transform: uppercase; }
.trade-metrics dd { min-width: 0; margin: 0.2rem 0 0; overflow-wrap: anywhere; font-size: 0.68rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pnl-positive { color: var(--long); }
.pnl-negative { color: var(--short); }
.pnl-flat { color: var(--muted); }
.trade-timeline,
.trade-reason { margin: 0; color: var(--muted); font-size: 0.58rem; line-height: 1.45; }
.trade-reason { margin-top: 0.35rem; color: #c1ccd8; }

.method-strip {
  display: grid;
  grid-template-columns: minmax(12rem, 0.55fr) minmax(0, 1.15fr) auto;
  align-items: center;
  gap: 1rem 2rem;
  margin: clamp(1.5rem, 4vw, 3rem) 0;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: linear-gradient(120deg, rgb(23 35 49 / 0.92), rgb(9 14 22 / 0.96));
}
.method-strip > p { margin: 0; color: var(--muted); font-size: 0.75rem; line-height: 1.6; }
.secondary-button { min-height: 2.75rem; padding: 0.5rem 0.75rem; border: 1px solid var(--line-strong); color: #dfe9f3; background: #182535; font-size: 0.68rem; }
.secondary-button:hover { border-color: var(--focus); background: #213247; }

.footer { padding: 1rem 0 0.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.58rem; line-height: 1.5; }
.footer span { color: #c5d0dc; font-weight: 900; letter-spacing: 0.08em; }
.footer p { margin: 0.35rem 0 0; }

.app-dialog {
  width: min(calc(100% - 1.5rem), 58rem);
  max-height: calc(100svh - 1.5rem);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 1.15rem;
  color: var(--text);
  background: #101722;
  box-shadow: 0 1.8rem 5rem rgb(0 0 0 / 0.66);
}
.settings-dialog { width: min(calc(100% - 1.5rem), 48rem); }
.market-dialog { width: min(calc(100% - 1.5rem), 64rem); }
.app-dialog::backdrop { background: rgb(2 5 9 / 0.82); backdrop-filter: blur(3px); }
.dialog-card { padding: clamp(1rem, 3vw, 1.6rem); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0.3rem 0 0; font-size: clamp(1.5rem, 4vw, 2.3rem); line-height: 1.05; letter-spacing: -0.045em; }
.dialog-close { font-size: 1.2rem; }
.settings-sections { display: grid; gap: 0; }
.settings-sections > section { padding: 1.2rem 0; border-bottom: 1px solid var(--line); }
.settings-sections > section:last-child { border-bottom: 0; }
.setting-heading { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1rem; }
.setting-heading > span { color: #7e8ea1; font-size: 0.56rem; font-weight: 900; }
.setting-heading h3 { margin: 0; font-size: 1rem; }
.setting-heading p { margin: 0.28rem 0 0; color: var(--muted); font-size: 0.64rem; line-height: 1.45; }
.range-readout { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: 0.72rem; font-weight: 800; }
.range-readout output { color: var(--focus); font-weight: 950; }
.range-control { width: 100%; min-height: 2.75rem; margin: 0.35rem 0 0.65rem; accent-color: var(--focus); }
.preset-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
.preset-row button { min-width: 0; padding: 0.4rem 0.25rem; border: 1px solid var(--line-strong); border-radius: 0.55rem; color: var(--text); background: var(--surface-soft); font-size: 0.65rem; font-weight: 850; }
.preset-row button.selected { color: #06101b; border-color: var(--focus); background: var(--focus); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.9rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--surface-soft); }
.switch-row span { min-width: 0; }
.switch-row strong,
.switch-row small { display: block; }
.switch-row strong { font-size: 0.72rem; }
.switch-row small { margin-top: 0.25rem; color: var(--muted); font-size: 0.56rem; line-height: 1.4; }
.switch-row input { width: 1.3rem; height: 1.3rem; flex: 0 0 auto; accent-color: var(--focus); }
.select-field { display: grid; gap: 0.35rem; margin-top: 0.8rem; color: var(--muted); font-size: 0.66rem; font-weight: 800; }
.select-field select { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.event-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; margin: 0.8rem 0 0; padding: 0.75rem; border: 1px solid var(--line); border-radius: 0.7rem; }
.event-choices legend { padding: 0 0.35rem; color: var(--muted); font-size: 0.6rem; font-weight: 850; }
.event-choices label { display: flex; align-items: center; gap: 0.4rem; color: #cfdae5; font-size: 0.62rem; }
.event-choices input { width: 1rem; height: 1rem; accent-color: var(--focus); }
.setting-note { margin: 0.65rem 0 0; color: var(--muted); font-size: 0.58rem; line-height: 1.45; }
.telegram-card { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.8rem; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--surface-soft); }
.telegram-card strong { font-size: 0.72rem; }
.telegram-card p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.58rem; line-height: 1.45; }

.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; margin-top: 1rem; }
.method-grid article { display: flex; min-width: 0; align-items: flex-start; gap: 0.65rem; padding: 0.85rem; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--surface-soft); }
.method-grid article > span { color: #7d8da0; font-size: 0.55rem; font-weight: 950; }
.method-grid h3 { margin: 0; font-size: 0.82rem; }
.method-grid p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.63rem; line-height: 1.55; }
.method-warning { margin-top: 0.8rem; padding: 0.85rem; border: 1px solid rgb(244 207 79 / 0.5); border-radius: 0.75rem; background: rgb(244 207 79 / 0.06); }
.method-warning strong { color: var(--anticipate-long); font-size: 0.72rem; }
.method-warning p { margin: 0.25rem 0 0; color: #d6d0ae; font-size: 0.63rem; line-height: 1.5; }

.market-detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.7rem; margin: 1rem 0; }
.market-price { font-size: 1.45rem; font-weight: 900; letter-spacing: -0.04em; }
.detail-stage-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.detail-stage-grid .stage-cell { width: 100%; min-height: 3rem; }
.detail-level-grid { margin-top: 0.7rem; }
.detail-section { margin-top: 0.8rem; padding: 0.8rem; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--surface-soft); }
.detail-section h3 { margin: 0; font-size: 0.82rem; }
.detail-section p { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.65rem; line-height: 1.55; }
.gate-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; margin-top: 0.6rem; }
.gate-row { display: flex; align-items: flex-start; gap: 0.45rem; min-width: 0; padding: 0.5rem; border: 1px solid var(--line); border-radius: 0.55rem; color: #c9d4df; font-size: 0.58rem; line-height: 1.35; }
.gate-marker { width: 0.55rem; height: 0.55rem; flex: 0 0 auto; margin-top: 0.1rem; border-radius: 50%; background: var(--wait); }
.gate-pass .gate-marker { background: var(--long); }
.gate-fail .gate-marker { background: var(--short); }
.gate-na .gate-marker { background: var(--wait); }

.toast {
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 120;
  width: min(calc(100% - 1.5rem), 25rem);
  padding: 0.8rem 0.9rem;
  border: 1px solid #58708a;
  border-radius: 0.75rem;
  color: #e8f1fa;
  background: #182536;
  box-shadow: 0 1rem 3rem var(--shadow);
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.45;
}
.toast.error { border-color: var(--short); }
.noscript-message { position: fixed; right: 1rem; bottom: 1rem; left: 1rem; z-index: 200; margin: 0; padding: 1rem; border: 1px solid var(--line-strong); border-radius: 0.75rem; background: var(--surface-raised); text-align: center; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1180px) {
  .scanner-header { align-items: flex-start; flex-direction: column; }
  .scan-controls { width: 100%; }
  .scanner-health-card { flex: 1 1 auto; }
  .method-strip { grid-template-columns: minmax(0, 1fr) auto; }
  .method-strip > p { grid-column: 1 / -1; grid-row: 2; }
  .method-strip .secondary-button { grid-column: 2; grid-row: 1; }
}

@media (max-width: 900px) {
  .topbar { align-items: flex-start; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .compact-health { margin-right: auto; }
  .cat-masthead { display: grid; min-height: 0; }
  .masthead-copy { width: 100%; min-height: 12rem; padding-bottom: 0.5rem; }
  .cat-track { position: relative; inset: auto; min-height: 10rem; margin: 0 0.8rem 1.2rem; }
  .masthead-floor { bottom: 1rem; }
  .signal-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .table-scroll { display: none; }
  .scanner-cards { display: grid; }
  .trade-grid { grid-template-columns: minmax(0, 1fr); }
  .method-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-stage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .dashboard-shell { padding-right: max(0.55rem, env(safe-area-inset-right)); padding-left: max(0.55rem, env(safe-area-inset-left)); }
  .topbar-brand { width: 100%; }
  .topbar-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-health { width: 100%; margin: 0; grid-column: 1 / -1; justify-content: center; }
  .topbar-actions .text-button,
  .topbar-actions .icon-button { width: 100%; }
  .masthead-copy h1 { font-size: clamp(2.15rem, 13vw, 3.6rem); }
  .cat-track { min-height: 8rem; }
  .cat-patrol { width: clamp(12rem, 58cqw, 20rem); }
  .scanner-section,
  .trades-section { padding: 0.8rem; border-radius: 0.9rem; }
  .scan-controls { flex-direction: column; }
  .scan-button { min-height: 3.2rem; }
  .scanner-meta { align-items: flex-start; flex-direction: column; }
  .signal-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .matrix-toolbar { align-items: stretch; flex-direction: column; }
  .sort-control { justify-content: space-between; }
  .sort-control select { min-width: 0; flex: 1; }
  .card-level-grid,
  .detail-level-grid { grid-template-columns: minmax(0, 1fr); }
  .section-header { align-items: stretch; flex-direction: column; }
  .export-menu summary { width: 100%; }
  .export-menu > div { right: auto; left: 0; width: 100%; }
  .trade-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-strip { grid-template-columns: minmax(0, 1fr); }
  .method-strip .secondary-button,
  .method-strip > p { grid-column: 1; grid-row: auto; }
  .app-dialog { width: calc(100% - 0.8rem); max-height: calc(100svh - 0.8rem); border-radius: 0.8rem; }
  .dialog-card { padding: 0.8rem; }
  .event-choices,
  .gate-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 390px) {
  .signal-summary { grid-template-columns: minmax(0, 1fr); }
  .stage-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-chip { width: 100%; }
  .trade-metrics { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .cat-patrol { transform: translateX(calc(100cqw - 100% - 2rem)); }
  .cat-facing { transform: scaleX(1); }
  .cat-image { transform: none; }
}

@media (prefers-contrast: more) {
  :root { --muted: #c8d3df; --line: #69798e; --line-strong: #9aaabe; }
  .scanner-section,
  .trades-section,
  .trade-panel,
  .scanner-card,
  .app-dialog,
  .field-group input,
  .sort-control select { border-width: 2px; }
  .signal-badge,
  .stage-cell { border-width: 2px; }
}
