@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Noto+Sans+Thai:wght@400;500;600;700&display=swap");

:root {
  --ink: #e9edf0;
  --muted: #8b969d;
  --panel: #111719;
  --panel-2: #151c1f;
  --line: #273034;
  --accent: #e7ff55;
  --accent-dark: #afc71f;
  --danger: #ff6d68;
  --page: #0a0f11;
  --dashboard-page: #07120f;
  --dashboard-card: #0b1d17;
  --dashboard-surface: #10271f;
  --dashboard-line: rgba(100, 160, 140, .2);
  --buy: #35d3a0;
  --sell: #ff6b6b;
  --dashboard-muted: #879994;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: "Noto Sans Thai", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 82% 7%, rgba(221, 255, 71, .07), transparent 24rem),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: auto, 48px 48px, 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 60%);
  z-index: -1;
}

.site-header {
  height: 80px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 5vw, 72px);
  background: rgba(10, 15, 17, .82);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  aspect-ratio: 1;
  color: #0b0f10;
  background: var(--accent);
  font: 600 17px "IBM Plex Mono", monospace;
  transform: rotate(-4deg);
}

.brand strong,
.brand small { display: block; font-family: "IBM Plex Mono", monospace; letter-spacing: .18em; }
.brand strong { font-size: 14px; }
.brand small { color: var(--muted); font-size: 8px; margin-top: 2px; }

.live-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font: 500 10px "IBM Plex Mono", monospace;
  letter-spacing: .1em;
}
.live-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.live-pill b { color: var(--ink); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.unlock-button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: 600 11px "Noto Sans Thai", sans-serif;
}
.unlock-button:hover { background: var(--accent); color: #0b0f10; }
.unlock-button:disabled { cursor: wait; opacity: .55; }
.logout-button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 600 11px "Noto Sans Thai", sans-serif;
}
.logout-button:hover { border-color: var(--ink); color: var(--ink); }

.auth-page { display: grid; place-items: center; padding: 24px; }
.auth-shell { width: min(460px, 100%); margin: 0; }
.auth-card {
  border: 1px solid var(--line);
  background: rgba(17, 23, 25, .94);
  padding: clamp(28px, 7vw, 52px);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .42);
}
.auth-brand { margin-bottom: 64px; }
.auth-card h1 { font-size: clamp(38px, 8vw, 54px); }
.auth-copy { margin: 18px 0 32px; color: var(--muted); line-height: 1.7; font-size: 20px; }
.auth-form { display: grid; gap: 12px; }
.auth-form label { color: var(--muted); font: 600 16px "IBM Plex Mono", monospace; letter-spacing: .16em; }
.auth-form input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: #0a0f11;
  color: var(--ink);
  padding: 0 15px;
  font: 500 18px "IBM Plex Mono", monospace;
}
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(231, 255, 85, .1); }
.auth-form button {
  min-height: 48px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #0a0f11;
  cursor: pointer;
  font: 700 13px "Noto Sans Thai", sans-serif;
}
.auth-form button:disabled { cursor: wait; opacity: .55; }
.auth-message { min-height: 24px; margin: 2px 0 0; color: var(--danger); font-size: 19px; line-height: 1.55; }
.auth-policy { margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 17px; line-height: 1.65; }

main { width: min(1520px, calc(100% - clamp(32px, 8vw, 120px))); margin: auto; }

.hero {
  min-height: 330px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 60px;
  align-items: end;
  padding: 66px 0 48px;
}

.eyebrow, .section-heading p {
  margin: 0 0 18px;
  color: var(--accent);
  font: 600 10px "IBM Plex Mono", monospace;
  letter-spacing: .2em;
}

h1 { margin: 0; font-size: clamp(38px, 5vw, 68px); line-height: 1.08; letter-spacing: -.04em; font-weight: 600; }
h1 em { color: var(--muted); font-style: normal; font-weight: 400; }
.hero-copy { color: var(--muted); line-height: 1.75; margin: 25px 0 0; font-size: 20px; }

.hero-metric {
  min-width: 240px;
  padding: 22px 0 4px 28px;
  border-left: 1px solid var(--line);
}
.hero-metric span, .schedule-note span, .data-meta span {
  display: block;
  color: var(--muted);
  font: 500 15px "IBM Plex Mono", monospace;
  letter-spacing: .15em;
}
.hero-metric strong { display: block; font: 500 56px "IBM Plex Mono", monospace; letter-spacing: -.06em; margin: 6px 0; }
.hero-metric small { color: var(--muted); font-size: 17px; }

.control-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(250px, 1fr) auto;
  align-items: end;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.control-panel > * { min-height: 88px; margin: 0; padding: 17px 20px; background: var(--panel); border: 0; }
label > span, fieldset legend {
  display: block;
  padding: 0;
  margin: 0 0 9px;
  color: var(--muted);
  font: 500 15px "IBM Plex Mono", monospace;
  letter-spacing: .15em;
}

select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  background: #0d1214;
  font: 500 18px "IBM Plex Mono", monospace;
}

.segmented { display: flex; height: 36px; }
.segmented button {
  min-width: 76px;
  flex: 1;
  border: 1px solid var(--line);
  background: #0d1214;
  color: var(--muted);
  cursor: pointer;
  font: 500 17px "IBM Plex Mono", monospace;
}
.segmented button + button { border-left: 0; }
.segmented button.active { color: #0b0f10; background: var(--accent); border-color: var(--accent); }
.schedule-note { min-width: 200px; display: flex; flex-direction: column; justify-content: center; }
.schedule-note strong { margin-top: 9px; font: 500 15px "IBM Plex Mono", monospace; }

.market-chart-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.market-chart-heading {
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 19px 24px;
  border-bottom: 1px solid var(--line);
}
.market-chart-heading .eyebrow { margin-bottom: 7px; }
.market-title-row { display: flex; align-items: baseline; gap: 16px; }
.market-title-row h2 { margin: 0; font-size: 20px; }
.market-title-row h2 span { color: var(--muted); font: 500 17px "IBM Plex Mono", monospace; }
.market-title-row strong { color: var(--accent); font: 500 23px "IBM Plex Mono", monospace; }
.market-chart-heading p:last-child { margin: 6px 0 0; color: var(--muted); font-size: 17px; }
.chart-ranges { display: flex; }
.chart-ranges button {
  height: 34px;
  min-width: 58px;
  border: 1px solid var(--line);
  background: #0d1214;
  color: var(--muted);
  cursor: pointer;
  font: 500 10px "IBM Plex Mono", monospace;
}
.chart-ranges button + button { border-left: 0; }
.chart-ranges button.active { color: #0b0f10; background: var(--accent); border-color: var(--accent); }
.chart-ranges button[data-chart-action="zoom-out"] { margin-left: 10px; border-left: 1px solid var(--line); }
.chart-ranges button[data-chart-action="reset"] { min-width: 66px; }
.chart-stage { position: relative; height: 430px; overflow: hidden; }
#goldChart { width: 100%; height: 100%; display: block; cursor: grab; }
#goldChart.dragging { cursor: grabbing; }
.chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 185px;
  padding: 9px 11px;
  border: 1px solid #394347;
  background: rgba(10, 15, 17, .94);
  color: var(--ink);
  pointer-events: none;
  font: 500 16px/1.65 "IBM Plex Mono", monospace;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.chart-legend {
  position: absolute;
  left: 14px;
  bottom: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  pointer-events: none;
  font: 500 15px "IBM Plex Mono", "Noto Sans Thai", monospace;
}
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.chart-legend i { width: 13px; height: 2px; background: var(--legend-color); }

.workspace {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 570px;
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.timeline-panel { border-right: 1px solid var(--line); }
.section-heading, .data-heading { padding: 24px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; }
.section-heading p { margin-bottom: 7px; }
.section-heading h2, .data-heading h2 { margin: 0; font-size: 17px; font-weight: 600; }
.section-heading > span { color: var(--muted); font: 500 16px "IBM Plex Mono", monospace; }

.timeline { max-height: 516px; overflow: auto; padding: 10px; }
.timeline-button {
  width: 100%;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font: 500 18px "IBM Plex Mono", monospace;
}
.timeline-button::before { content: ""; width: 5px; height: 5px; border: 1px solid #586267; transform: rotate(45deg); }
.timeline-button small { font-size: 15px; color: #677278; }
.timeline-button:hover { background: var(--panel-2); color: var(--ink); }
.timeline-button.active { background: var(--accent); color: #0b0f10; }
.timeline-button.active::before { background: #0b0f10; border-color: #0b0f10; }
.timeline-button.active small { color: #3f490c; }

.data-panel { min-width: 0; }
.data-heading { display: flex; justify-content: space-between; align-items: center; min-height: 102px; }
.snapshot-label { display: flex; align-items: center; gap: 7px; color: var(--accent); font: 600 9px "IBM Plex Mono", monospace; letter-spacing: .14em; margin-bottom: 8px; }
.snapshot-label i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.data-heading p { color: var(--muted); margin: 7px 0 0; font-size: 17px; }
.data-meta { text-align: right; }
.data-meta strong { font: 500 24px "IBM Plex Mono", monospace; }

.table-wrap { max-width: 100%; max-height: 490px; overflow: auto; }
.snapshot-table-section + .snapshot-table-section { border-top: 8px solid var(--page); }
.snapshot-table-title {
  position: sticky;
  left: 0;
  margin: 0;
  padding: 10px 16px;
  color: var(--accent);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font: 600 10px "IBM Plex Mono", "Noto Sans Thai", monospace;
  letter-spacing: .06em;
}
table { width: 100%; border-collapse: collapse; font: 400 17px "IBM Plex Mono", "Noto Sans Thai", monospace; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; padding: 14px 16px; color: var(--muted); background: #0e1416; border-bottom: 1px solid var(--line); text-align: right; font-size: 15px; letter-spacing: .07em; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; }
th:first-child { z-index: 2; }
td:first-child { background: var(--panel); }
td { padding: 14px 16px; border-bottom: 1px solid #20282b; text-align: right; }
tbody tr:hover td { background: #181f21; }
.state-card { min-height: 380px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13px; }
.state-card strong { color: var(--ink); font-size: 18px; }
.state-card.error { color: var(--danger); padding: 30px; text-align: center; }
.hidden { display: none !important; }

.paper-panel { margin-top: 18px; border: 1px solid var(--line); background: var(--panel); }
.paper-heading {
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.paper-heading .eyebrow { margin-bottom: 7px; }
.paper-heading h2 { margin: 0; font-size: 19px; }
.paper-heading p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 17px; }
.paper-tabs { display: flex; }
.paper-tabs button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #0d1214;
  color: var(--muted);
  cursor: pointer;
  font: 500 15px "IBM Plex Mono", monospace;
}
.paper-tabs button + button { border-left: 0; }
.paper-tabs button.active { color: #0b0f10; background: var(--accent); border-color: var(--accent); }
.paper-mode-switch {
  display: flex;
  gap: 8px;
  padding: 14px 20px 0;
  background: var(--dashboard-page);
}
.paper-mode-switch button {
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid var(--dashboard-line);
  border-radius: 8px;
  background: var(--dashboard-card);
  color: var(--dashboard-muted);
  cursor: pointer;
  font: 700 14px "IBM Plex Mono", monospace;
}
.paper-mode-switch button.active {
  border-color: var(--accent);
  background: rgba(231, 255, 85, .1);
  color: var(--accent);
}
.paper-view { max-width: 100%; overflow: auto; }
.paper-table { min-width: 1080px; }
.paper-table th:first-child, .paper-table td:first-child { position: sticky; left: 0; z-index: 2; background: var(--panel); }
.paper-table th:first-child { background: #0e1416; }
.sort-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: inherit;
  font: inherit;
  letter-spacing: inherit;
}
.sort-button:hover, .sort-button.active { color: var(--accent); }
.signal-name { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; }
.signal-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--signal-color); box-shadow: 0 0 9px var(--signal-color); }
.metric-cell strong, .target-status { display: block; font-weight: 600; color: var(--ink); }
.metric-cell small { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; }
.status-tp { color: #45d69a; }
.status-sl { color: var(--danger); }
.status-pending { color: #f6c85f; }
.paper-empty { min-height: 180px; display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.event-type { display: inline-grid; min-width: 48px; place-items: center; padding: 3px 6px; border: 1px solid currentColor; font: 600 15px "IBM Plex Mono", monospace; }
.quality-warning-list { display: grid; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.quality-warning {
  display: grid;
  grid-template-columns: minmax(180px, .35fr) minmax(0, 1fr);
  gap: 18px;
  padding: 13px 15px;
  border: 1px solid rgba(246, 200, 95, .35);
  border-radius: 8px;
  background: rgba(246, 200, 95, .06);
}
.quality-warning div { display: grid; gap: 4px; }
.quality-warning span { color: #f6c85f; font: 700 13px "IBM Plex Mono", monospace; }
.quality-warning strong { font-size: 16px; }
.quality-warning p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.55; }

/* Statistics dashboard */
#paperStats { overflow: visible; background: var(--dashboard-page); }
.statistics-dashboard {
  display: grid;
  gap: 18px;
  padding: 20px;
  background:
    radial-gradient(circle at 88% 3%, rgba(53, 211, 160, .055), transparent 24rem),
    var(--dashboard-page);
  color: var(--ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.statistics-dashboard button,
.statistics-dashboard select { font-family: inherit; }
.statistics-dashboard-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  padding: 2px 4px;
  color: var(--dashboard-muted);
  font: 600 13px "IBM Plex Mono", "Noto Sans Thai", monospace;
  letter-spacing: .06em;
}
.statistics-dashboard-meta span { display: inline-flex; align-items: center; gap: 7px; }
.statistics-dashboard-meta span:last-child { margin-left: auto; }
.statistics-dashboard-meta i { width: 7px; height: 7px; border-radius: 50%; }
.buy-dot { background: var(--buy); box-shadow: 0 0 10px var(--buy); }
.sell-dot { background: var(--sell); box-shadow: 0 0 10px var(--sell); }
.statistics-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--dashboard-line);
  border-radius: 10px;
  background: var(--dashboard-card);
}
.dashboard-section-heading {
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--dashboard-line);
}
.dashboard-section-heading.compact { min-height: 92px; }
.dashboard-section-heading h3,
.selected-setup-heading h3,
.dte-heading h3 { margin: 0; font-size: 21px; line-height: 1.35; }
.dashboard-section-heading p:last-child,
.selected-setup-heading p:last-child { margin: 5px 0 0; color: var(--dashboard-muted); font-size: 15px; }
.section-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  font: 600 11px "IBM Plex Mono", monospace;
  letter-spacing: .16em;
}
.target-selector { width: min(290px, 100%); flex: 0 0 auto; }
.target-selector > span { margin-bottom: 7px; font-size: 12px; }
.target-selector select {
  height: 42px;
  border-radius: 7px;
  border-color: var(--dashboard-line);
  background: var(--dashboard-surface);
  font-size: 15px;
}
.target-selector select:focus-visible,
.statistics-dashboard button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ranking-scroll { max-width: 100%; overflow-x: auto; }
.ranking-table { min-width: 1220px; font-size: 15px; }
.ranking-table th {
  position: static;
  padding: 12px 14px;
  background: #0a1814;
  border-color: var(--dashboard-line);
  color: var(--dashboard-muted);
  font-size: 12px;
  text-align: left;
}
.ranking-table td {
  padding: 14px;
  border-color: var(--dashboard-line);
  text-align: left;
  vertical-align: middle;
}
.ranking-table th:first-child,
.ranking-table td:first-child { position: static; background: inherit; }
.ranking-table tbody tr:hover td { background: rgba(255, 255, 255, .018); }
.ranking-table td small { display: block; margin-top: 3px; color: var(--dashboard-muted); font-size: 12px; }
.ranking-index {
  width: 29px;
  height: 29px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--dashboard-line);
  border-radius: 7px;
  color: var(--accent);
  background: var(--dashboard-surface);
  font: 700 13px "IBM Plex Mono", monospace;
}
.setup-label { font-size: 15px; }
.setup-label.buy { color: var(--buy); }
.setup-label.sell { color: var(--sell); }
.numeric,
.rate-value,
.duration-value { font-family: "IBM Plex Mono", "Noto Sans Thai", monospace; }
.rate-value { font-size: 16px; }
.insufficient-value,
.recommendation-empty { color: var(--dashboard-muted); white-space: normal; font-size: 13px; }
.linear-progress {
  width: 100%;
  min-width: 100px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(135, 153, 148, .16);
}
.linear-progress > span { display: block; width: var(--progress); height: 100%; border-radius: inherit; background: var(--accent); }
.linear-progress.no-data > span { width: 0; }

.heatmap-legend { display: flex; align-items: center; gap: 5px; color: var(--dashboard-muted); font: 500 12px "IBM Plex Mono", monospace; }
.heatmap-legend i { width: 22px; height: 8px; border-radius: 2px; background: var(--buy); opacity: calc(.18 + var(--legend-step, 0)); }
.heatmap-legend i:nth-of-type(2) { --legend-step: .2; }
.heatmap-legend i:nth-of-type(3) { --legend-step: .45; }
.heatmap-legend i:nth-of-type(4) { --legend-step: .72; }
.heatmap-scroll { overflow-x: auto; padding: 18px 20px 22px; }
.heatmap-grid {
  min-width: 920px;
  display: grid;
  grid-template-columns: 116px repeat(6, minmax(112px, 1fr));
  gap: 7px;
}
.heatmap-corner,
.heatmap-column-label,
.heatmap-row-label { min-height: 45px; display: flex; justify-content: center; flex-direction: column; padding: 7px 10px; }
.heatmap-corner { color: var(--dashboard-muted); font: 600 11px "IBM Plex Mono", monospace; }
.heatmap-column-label { align-items: center; font: 700 13px "IBM Plex Mono", monospace; }
.heatmap-column-label.sell { color: var(--sell); }
.heatmap-column-label.buy { color: var(--buy); }
.heatmap-row-label { align-items: flex-start; border-top: 1px solid var(--dashboard-line); }
.heatmap-row-label strong { font: 700 15px "IBM Plex Mono", monospace; }
.heatmap-row-label small { margin-top: 2px; color: var(--dashboard-muted); font-size: 12px; }
.heatmap-cell {
  isolation: isolate;
  position: relative;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  border: 1px solid var(--dashboard-line);
  border-radius: 8px;
  background: var(--dashboard-surface);
  color: var(--ink);
  cursor: pointer;
}
.heatmap-cell::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--cell-color); opacity: calc(var(--intensity) * .68); }
.heatmap-cell.sell { --cell-color: var(--sell); }
.heatmap-cell.buy { --cell-color: var(--buy); }
.heatmap-cell:hover { transform: translateY(-1px); border-color: currentColor; }
.heatmap-cell.selected { border: 2px solid var(--accent); box-shadow: 0 0 0 2px rgba(231, 255, 85, .13), inset 0 0 22px rgba(0, 0, 0, .16); }
.heatmap-cell strong { color: #f6fbf9; font: 800 19px "IBM Plex Mono", monospace; text-shadow: 0 1px 3px rgba(0,0,0,.55); }
.heatmap-cell small { color: rgba(255,255,255,.78); font: 600 12px "IBM Plex Mono", monospace; }
.heatmap-cell.no-data { cursor: not-allowed; background: rgba(135, 153, 148, .035); color: var(--dashboard-muted); }
.heatmap-cell.no-data strong { color: var(--dashboard-muted); }
.heatmap-cell.no-data::before { display: none; }

.selected-setup-heading {
  min-height: 104px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 24px;
  padding: 19px 22px;
  border-bottom: 1px solid var(--dashboard-line);
}
.selected-setup-summary { display: flex; align-items: center; gap: 14px; }
.selected-setup-summary span { display: grid; color: var(--dashboard-muted); font: 600 11px "IBM Plex Mono", monospace; letter-spacing: .06em; }
.selected-setup-summary span b { color: var(--ink); font-size: 15px; }
.selected-setup-summary > strong { color: var(--accent); font: 800 24px "IBM Plex Mono", monospace; }
.selected-setup-summary em,
.setup-performance-card header em { padding: 4px 7px; border: 1px solid #f6c85f; border-radius: 5px; color: #f6c85f; font: 700 10px "IBM Plex Mono", monospace; font-style: normal; }
.detail-toggle {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--dashboard-line);
  border-radius: 7px;
  background: var(--dashboard-surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}
.detail-toggle:hover { border-color: var(--accent); color: var(--accent); }
.target-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 18px 20px 20px; }
.target-stat-card { min-width: 0; padding: 15px; border: 1px solid var(--dashboard-line); border-radius: 9px; background: var(--dashboard-surface); }
.target-stat-card > header { display: flex; justify-content: space-between; align-items: baseline; color: var(--dashboard-muted); }
.target-stat-card > header span { font-size: 13px; }
.target-stat-card > header strong { color: var(--ink); font: 700 17px "IBM Plex Mono", monospace; }
.target-rate { display: flex; align-items: baseline; gap: 10px; padding: 14px 0 12px; }
.target-rate strong { color: var(--accent); font: 800 25px "IBM Plex Mono", monospace; }
.target-stat-card.no-data .target-rate strong { color: var(--dashboard-muted); }
.target-rate span { color: var(--dashboard-muted); font: 500 12px "IBM Plex Mono", monospace; }
.target-stat-card dl { display: grid; gap: 7px; margin: 0; }
.target-stat-card dl > div { display: flex; justify-content: space-between; gap: 12px; }
.target-stat-card dt { color: var(--dashboard-muted); font-size: 13px; }
.target-stat-card dd { margin: 0; text-align: right; font: 600 13px "IBM Plex Mono", "Noto Sans Thai", monospace; }
.duration-note { margin: 11px 0 0; padding-top: 8px; border-top: 1px solid var(--dashboard-line); color: var(--dashboard-muted); font-size: 12px; }

.dte-heading { border-bottom: 0; }
.dte-tabs { display: flex; gap: 7px; overflow-x: auto; padding: 0 20px 16px; border-bottom: 1px solid var(--dashboard-line); }
.dte-tabs button {
  min-width: 128px;
  min-height: 54px;
  display: flex;
  justify-content: center;
  flex-direction: column;
  border: 1px solid var(--dashboard-line);
  border-radius: 8px;
  background: var(--dashboard-surface);
  color: var(--dashboard-muted);
  cursor: pointer;
}
.dte-tabs button strong { font: 700 14px "IBM Plex Mono", monospace; }
.dte-tabs button small { margin-top: 2px; font-size: 11px; }
.dte-tabs button.active { color: #08110e; border-color: var(--accent); background: var(--accent); }
.breakdown-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--dashboard-line); }
.breakdown-column { min-width: 0; padding: 18px; background: var(--dashboard-card); }
.breakdown-column > header { margin-bottom: 12px; }
.breakdown-column > header > div { display: flex; align-items: center; gap: 11px; }
.direction-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 8px; font: 700 20px "IBM Plex Mono", monospace; }
.breakdown-column.buy .direction-mark,
.breakdown-column.buy h4 { color: var(--buy); }
.breakdown-column.sell .direction-mark,
.breakdown-column.sell h4 { color: var(--sell); }
.breakdown-column h4 { margin: 0; font-size: 17px; }
.breakdown-column header p { margin: 3px 0 0; color: var(--dashboard-muted); font-size: 13px; }
.setup-card-stack { display: grid; gap: 11px; }
.setup-performance-card { min-width: 0; padding: 16px; border: 1px solid var(--dashboard-line); border-radius: 9px; background: var(--dashboard-surface); }
.setup-performance-card > header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 13px; border-bottom: 1px solid var(--dashboard-line); }
.setup-performance-card > header span { color: var(--dashboard-muted); font: 500 11px "IBM Plex Mono", monospace; }
.setup-performance-card h5 { margin: 2px 0 0; font: 700 16px "IBM Plex Mono", monospace; }
.setup-performance-card.buy h5 { color: var(--buy); }
.setup-performance-card.sell h5 { color: var(--sell); }
.setup-performance-summary { display: flex; align-items: center; gap: 15px; padding: 15px 0; }
.setup-performance-summary > div:last-child { display: grid; }
.setup-performance-summary > div:last-child strong { font: 700 17px "IBM Plex Mono", monospace; }
.setup-performance-summary > div:last-child span,
.setup-performance-summary > div:last-child small { color: var(--dashboard-muted); font-size: 12px; }
.circular-progress {
  --ring-color: var(--accent);
  position: relative;
  width: 82px;
  height: 82px;
  flex: 0 0 82px;
  display: grid;
  place-content: center;
  border-radius: 50%;
  text-align: center;
  background: conic-gradient(var(--ring-color) var(--progress), rgba(135,153,148,.14) 0);
}
.circular-progress::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--dashboard-surface); }
.circular-progress strong,
.circular-progress small { position: relative; z-index: 1; }
.circular-progress strong { font: 800 16px "IBM Plex Mono", monospace; }
.circular-progress small { margin-top: 1px; color: var(--dashboard-muted); font: 600 8px "IBM Plex Mono", monospace; }
.circular-progress.no-data { --ring-color: transparent; }
.target-progress-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.target-progress-list li { display: grid; grid-template-columns: 100px minmax(70px, 1fr) minmax(150px, auto); align-items: center; gap: 10px; }
.target-progress-meta { display: flex; justify-content: space-between; gap: 7px; font: 600 12px "IBM Plex Mono", monospace; }
.target-progress-meta span { color: var(--dashboard-muted); }
.target-progress-time { display: flex; justify-content: flex-end; gap: 9px; color: var(--dashboard-muted); font: 500 10px "IBM Plex Mono", "Noto Sans Thai", monospace; }
.statistics-state { min-height: 330px; display: grid; place-content: center; justify-items: center; gap: 9px; padding: 30px; text-align: center; color: var(--dashboard-muted); }
.statistics-state > span:first-child { color: var(--accent); font-size: 30px; }
.statistics-state strong { color: var(--ink); font-size: 17px; }
.statistics-state small { max-width: 450px; font-size: 14px; }
.statistics-error small { color: var(--danger); }
.statistics-loader { width: 28px; height: 28px; border: 2px solid var(--dashboard-line); border-top-color: var(--accent); border-radius: 50%; animation: statistics-spin .8s linear infinite; }
@keyframes statistics-spin { to { transform: rotate(360deg); } }

footer {
  width: min(1520px, calc(100% - clamp(32px, 8vw, 120px)));
  margin: 28px auto;
  display: flex;
  justify-content: space-between;
  color: #596469;
  font: 500 15px "IBM Plex Mono", "Noto Sans Thai", monospace;
  letter-spacing: .08em;
}

@media (max-width: 840px) {
  .site-header { height: 68px; }
  main { width: calc(100% - 28px); }
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 48px 0 30px; }
  .hero-metric { border-left: 0; border-top: 1px solid var(--line); padding: 18px 0 0; }
  .hero-metric strong { font-size: 40px; }
  .control-panel { grid-template-columns: 1fr; }
  .control-panel > * { min-height: 78px; }
  .schedule-note { display: none; }
  .market-chart-heading { align-items: flex-start; flex-direction: column; gap: 15px; }
  .chart-ranges { max-width: 100%; overflow-x: auto; }
  .chart-stage { height: 360px; }
  .workspace { width: 100%; grid-template-columns: minmax(0, 1fr); }
  .timeline-panel { min-width: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .table-wrap, .paper-view, .timeline { width: 100%; min-width: 0; }
  .paper-heading { align-items: flex-start; flex-direction: column; }
  .paper-tabs { max-width: 100%; overflow-x: auto; }
  .quality-warning { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .timeline { display: flex; max-height: none; overflow-x: auto; }
  .timeline-button { min-width: 120px; grid-template-columns: 8px 1fr; }
  .timeline-button small { display: none; }
  footer { width: calc(100% - 28px); flex-direction: column; gap: 10px; }
  .desktop-only { display: none; }
  .header-actions { gap: 10px; }
  .unlock-button { padding: 0 9px; font-size: 10px; }
  .live-pill { display: none; }
  .statistics-dashboard { padding: 12px; gap: 12px; }
  .statistics-dashboard-meta span:last-child { width: 100%; margin-left: 0; }
  .dashboard-section-heading { align-items: flex-start; flex-direction: column; gap: 14px; padding: 17px; }
  .target-selector { width: 100%; }
  .heatmap-scroll { padding: 12px; }
  .selected-setup-heading { grid-template-columns: 1fr auto; gap: 14px; padding: 17px; }
  .selected-setup-summary { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .detail-toggle { grid-column: 2; grid-row: 1; }
  .target-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; }
  .dte-tabs { padding: 0 12px 12px; }
  .breakdown-grid { grid-template-columns: minmax(0, 1fr); }
  .breakdown-column { padding: 12px; }
  .target-progress-list li { grid-template-columns: 92px minmax(60px, 1fr); }
  .target-progress-time { grid-column: 1 / -1; justify-content: flex-start; padding-left: 102px; }
}

@media (max-width: 520px) {
  .statistics-dashboard { margin-inline: -1px; padding: 8px; }
  .dashboard-section-heading h3,
  .selected-setup-heading h3,
  .dte-heading h3 { font-size: 19px; }
  .statistics-dashboard-meta { font-size: 11px; }
  .selected-setup-heading { display: flex; align-items: stretch; flex-direction: column; }
  .selected-setup-summary { order: 2; flex-wrap: wrap; }
  .detail-toggle { order: 3; width: 100%; }
  .target-card-grid { grid-template-columns: minmax(0, 1fr); }
  .target-stat-card { padding: 13px; }
  .dte-tabs button { min-width: 112px; }
  .setup-performance-card { padding: 13px; }
  .setup-performance-summary { align-items: flex-start; }
  .target-progress-list li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .target-progress-time { grid-column: auto; padding-left: 0; justify-content: flex-start; }
  .target-progress-meta { justify-content: flex-start; gap: 14px; }
}
