:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --border: #e5eaf2;
  --text: #172033;
  --muted: #667085;
  --blue: #2264d1;
  --blue-soft: #eaf1ff;
  --green: #00a878;
  --red: #e5484d;
  --amber: #c27803;
  --shadow: 0 18px 45px rgba(24, 39, 75, 0.08);
}

* {
  box-sizing: border-box;
}

[v-cloak] {
  display: none;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(34, 100, 209, 0.12), transparent 28%),
    linear-gradient(180deg, #f7f9fd 0%, var(--bg) 100%);
}

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border-right: 1px solid var(--border);
  box-shadow: 12px 0 36px rgba(24, 39, 75, 0.04);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, #2264d1, #00a878);
  font-weight: 900;
  font-size: 1.25rem;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.82rem;
}

.nav-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 13px 14px;
  background: transparent;
  color: #526173;
  text-align: left;
  cursor: pointer;
  font-size: 0.96rem;
}

.nav-list button.active,
.nav-list button:hover {
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(34, 100, 209, 0.12);
}

.side-card {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f7f9ff 0%, #eef4ff 100%);
  border: 1px solid #dce8ff;
}

.side-card select,
.side-card button {
  width: 100%;
  height: 38px;
  border: 1px solid #d8e0ea;
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.inline-select {
  height: 38px;
  min-width: 150px;
  border: 1px solid #d8e0ea;
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.inline-filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.side-card button {
  cursor: pointer;
  font-weight: 800;
}

.side-card span,
.side-card small {
  color: var(--muted);
}

.workspace {
  padding: 26px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.data-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.data-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: #344054;
  background: #f3f6fb;
  border: 1px solid #e5eaf2;
  font-size: 0.92rem;
}

.panel-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.toolbar {
  min-width: 380px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toolbar select {
  grid-column: 1 / -1;
}

.page-alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #fecdd3;
  border-radius: 14px;
  color: #9f1239;
  background: #fff1f2;
}

.screen {
  display: none;
  gap: 18px;
}

.screen.active {
  display: grid;
}

select,
button,
input {
  font: inherit;
}

.toolbar select,
.toolbar button,
.number-input {
  height: 40px;
  border: 1px solid #d8e0ea;
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.toolbar button {
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  border-color: var(--blue) !important;
  color: #fff !important;
  background: var(--blue) !important;
}

.ghost-btn {
  color: #344054;
  background: #f7f9fc !important;
}

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

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card,
.panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 140px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--blue-soft);
}

.stat-card.primary::after {
  background: rgba(34, 100, 209, 0.14);
}

.stat-card.success::after {
  background: rgba(0, 168, 120, 0.14);
}

.stat-card span,
.stat-card small {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 2.55rem;
  letter-spacing: -0.04em;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(360px, 0.9fr);
  gap: 18px;
}

.polymarket-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.15fr) minmax(360px, 0.85fr);
  gap: 18px;
}

.panel {
  padding: 20px;
  overflow: auto;
}

.trend-panel {
  grid-column: 1 / -1;
}

.trend-chart {
  height: 340px;
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  align-items: center;
  margin-bottom: 12px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.table-toolbar strong,
.table-toolbar span {
  display: block;
}

.table-toolbar strong {
  font-size: 1.04rem;
}

.table-toolbar span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.pagination-info {
  flex-shrink: 0;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-numbers {
  display: flex;
  gap: 4px;
}

.page-num {
  min-width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  transition: all 0.15s;
}

.page-num:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

.page-num.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 600;
}

.page-ellipsis {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 2px;
}

.page-size-select {
  height: 32px;
  margin-left: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 8px;
  background: #fff;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}

.manual-ops-block {
  border-top: 1px solid var(--border);
  margin-top: 18px;
  padding-top: 16px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.stats-result-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(460px, 1.05fr);
  gap: 18px;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.group-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.group-head strong,
.group-head span {
  display: block;
}

.group-head strong {
  font-size: 0.96rem;
}

.group-head span,
.group-metrics {
  color: var(--muted);
  font-size: 0.8rem;
}

.group-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-metrics span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
}

.strategy-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.strategy-chip-list.compact {
  margin-top: -2px;
}

.strategy-chip {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid #dbe7f5;
  border-radius: 10px;
  color: #172033;
  background: #ffffff;
  font-weight: 800;
  font-size: 0.78rem;
}

.strategy-chip.muted {
  border-color: #e3e9f2;
  color: #536176;
  background: #f6f9fd;
  font-weight: 700;
}

.strategy-chip small {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
}

.filter-grid label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 800;
  font-size: 0.9rem;
}

.filter-grid select,
.filter-grid input {
  height: 40px;
  border: 1px solid #d8e0ea;
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.filter-grid input:disabled {
  color: #98a2b3;
  background: #f2f4f7;
}

.chart-panel {
  padding: 18px;
}

.chart-title {
  margin-bottom: 10px;
}

.chart-meta {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.chart-meta span {
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
}

.kline-chart {
  height: 640px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #ffffff;
}

.mini-chart {
  height: 300px;
}

.chart-fallback {
  height: 100%;
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  color: var(--muted);
  background: #f8fafc;
  text-align: center;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 140px;
  margin-bottom: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  color: var(--muted);
  background: #f8fafc;
}

.empty-state strong {
  color: var(--text);
}

.ops-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid #edf1f6;
  border-radius: 16px;
}

.ops-table th,
.ops-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  white-space: nowrap;
}

.ops-table th {
  color: #667085;
  background: #f7f9fc;
  font-size: 0.9rem;
  font-weight: 800;
}

.ops-table td {
  color: #172033;
  background: #fff;
  font-size: 0.92rem;
  vertical-align: top;
}

.ops-table tr:last-child td {
  border-bottom: 0;
}

.ops-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.signals-table-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #edf1f6;
  border-radius: 16px;
  -webkit-overflow-scrolling: touch;
}

.signals-table-scroll .ops-table {
  border: 0;
  border-radius: 0;
}

.signals-table {
  min-width: 1080px;
}

.signals-table td:nth-child(4),
.signals-table td:nth-child(12) {
  max-width: 220px;
  white-space: normal;
}

.signals-table td:nth-child(12) {
  min-width: 160px;
}

.check-col {
  width: 48px;
  text-align: center !important;
}

.inline-search {
  height: 38px;
  min-width: 180px;
  border: 1px solid #d8e0ea;
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.log-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
}

.log-level.error {
  background: #fef2f2;
  color: var(--red);
}

.log-level.warning {
  background: #fffbeb;
  color: var(--amber);
}

.log-level.info {
  background: var(--blue-soft);
  color: var(--blue);
}

.log-level.debug {
  background: #f3f4f6;
  color: #6b7280;
}

.log-category {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #f3f4f6;
  color: #374151;
}

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f3f7;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-time {
  flex-shrink: 0;
  width: 140px;
  font-size: 0.82rem;
  color: var(--muted);
  padding-top: 2px;
}

.log-badges {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 72px;
}

.log-body {
  flex: 1;
  min-width: 0;
}

.log-message {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.log-detail {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.log-detail-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  background: #f9fafb;
  color: #6b7280;
}

.log-detail-item strong {
  color: #374151;
  font-weight: 600;
}

.log-type-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.log-type-tag.system {
  background: #eff6ff;
  color: var(--blue);
}

.log-type-tag.settlement {
  background: #f0fdf4;
  color: #16a34a;
}

.compact-table {
  margin-top: 18px;
}

.empty-cell {
  color: var(--muted) !important;
  text-align: center !important;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 900;
}

.side-pill,
.level-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 5px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.78rem;
}

.side-pill.long {
  color: #006b4f;
  background: #dff8ee;
}

.side-pill.short {
  color: #9f1239;
  background: #ffe4e8;
}

.level-pill.s {
  color: #7c4a03;
  background: #fff3cd;
}

.level-pill.ss {
  color: #174ea6;
  background: #e8f0fe;
}

.level-pill.sss {
  color: #6f1ab6;
  background: #f3e8ff;
}

.result-pill {
  display: inline-flex;
  min-width: 48px;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.78rem;
  color: #475467;
  background: #f2f4f7;
}

.result-pill.win {
  color: #006b4f;
  background: #dff8ee;
}

.result-pill.loss {
  color: #9f1239;
  background: #ffe4e8;
}

.result-pill.draw {
  color: #7c4a03;
  background: #fff3cd;
}

.signal-mini-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  white-space: normal;
  line-height: 1.35;
}

.signal-mini-stack strong {
  color: #172033;
  font-weight: 800;
}

.signal-mini-muted {
  color: #7a8699;
  font-size: 0.8rem;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
}

.switch-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.number-input {
  width: 96px;
}

.params-input {
  width: 220px;
  min-height: 72px;
  resize: vertical;
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  padding: 8px;
  color: var(--text);
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
}

.tg-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.tg-config-grid label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 800;
}

.tg-switch {
  min-height: 42px;
  align-content: center;
}

.tg-text-input {
  height: 38px;
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
}

.tg-textarea {
  width: 100%;
  min-height: 118px;
}

.tg-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 24px;
  border: 1px solid #cfe0ff;
  border-radius: 28px;
  background:
    radial-gradient(circle at 12% 10%, rgba(34, 100, 209, 0.18), transparent 30%),
    linear-gradient(135deg, #ffffff 0%, #eef5ff 58%, #eefbf6 100%);
  box-shadow: var(--shadow);
}

.tg-hero-copy {
  display: grid;
  gap: 8px;
  max-width: 720px;
}

.tg-eyebrow {
  width: max-content;
  padding: 5px 9px;
  border-radius: 999px;
  color: #1552b2;
  background: rgba(34, 100, 209, 0.1);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tg-hero-copy strong {
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  letter-spacing: -0.04em;
}

.tg-hero-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.tg-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: 260px;
}

.tg-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.tg-status-grid article {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 32px rgba(24, 39, 75, 0.06);
}

.tg-status-grid span,
.tg-status-grid small {
  color: var(--muted);
}

.tg-status-grid strong {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.tg-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  margin-top: 18px;
}

.tg-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.tg-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.tg-card-head strong,
.tg-card-head span {
  display: block;
}

.tg-card-head strong {
  font-size: 1.05rem;
}

.tg-card-head span {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.tg-toggle-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.tg-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid #dce8ff;
  border-radius: 16px;
  background: #f8fbff;
}

.tg-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.tg-toggle span,
.tg-toggle strong,
.tg-toggle small {
  display: block;
}

.tg-toggle small {
  margin-top: 3px;
  color: var(--muted);
}

.tg-field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: #344054;
  font-weight: 900;
}

.tg-field .tg-text-input,
.tg-field .tg-textarea {
  font-weight: 500;
}

.tg-target-card .tg-textarea {
  min-height: 132px;
}

.tg-webhook-note {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f6f8fb;
  color: var(--muted);
}

.tg-webhook-note code {
  color: #1552b2;
  font-weight: 900;
}

.tg-log-card {
  margin-top: 18px;
  border-style: dashed;
  box-shadow: none;
}

.tg-actions {
  align-items: center;
}

.tg-panel {
  display: grid;
  gap: 18px;
}

.tg-header {
  margin-bottom: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.tg-status-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.tg-status-cards article {
  display: grid;
  gap: 5px;
  min-height: 104px;
  padding: 16px;
  border: 1px solid #e1e8f2;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.tg-status-cards span,
.tg-status-cards small {
  color: var(--muted);
  line-height: 1.35;
}

.tg-status-cards strong {
  color: var(--text);
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.tg-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 18px;
  padding: 12px;
  border: 1px solid #e5eaf2;
  border-radius: 16px;
  background: #f7f9fc;
  color: var(--muted);
  font-size: 0.88rem;
}

.tg-summary-row span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
}

.tg-summary-row strong {
  color: var(--text);
}

.tg-form-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.2fr);
  gap: 18px;
}

.tg-form-section {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.tg-form-section h3 {
  margin: 0;
  font-size: 1rem;
}

.tg-section-title {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f7;
}

.tg-section-title span {
  color: var(--muted);
  font-size: 0.88rem;
}

.tg-form-section .switch-row {
  justify-content: flex-start;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f7f9fc;
}

.tg-label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 800;
}

.tg-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.tg-help code {
  color: var(--blue);
  font-weight: 900;
}

.tg-note-list {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  color: var(--muted);
  background: #f7f9fc;
  font-size: 0.86rem;
  line-height: 1.5;
}

.tg-error-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 16px;
  padding: 12px;
  border: 1px dashed #d8e0ea;
  border-radius: 16px;
  color: var(--muted);
  background: #fbfcfe;
}

.tg-error-box strong {
  color: var(--text);
}

.table-btn {
  height: 34px;
  border: 1px solid var(--blue);
  border-radius: 10px;
  padding: 0 12px;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

.table-btn.secondary {
  color: var(--blue);
  background: var(--blue-soft);
}

.table-btn.danger {
  border-color: #fda4af;
  color: #7f1d1d;
  background: #fee2e2;
}

.table-btn.mute {
  border-color: #fbbf24;
  color: #7c4a03;
  background: #fff7d6;
}

.table-btn.restore {
  border-color: #00a878;
  color: #006b4f;
  background: #dff8ee;
}

.trading-tabs,
.signals-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 6px;
  border: 1px solid #dbe7f5;
  border-radius: 12px;
  background: #f7fafc;
}

.trading-tabs button,
.signals-tabs button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  color: #4a5f7a;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.trading-tabs button.active,
.signals-tabs button.active {
  border-color: #b9d2f2;
  color: #0f3f78;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(31, 92, 153, 0.08);
}

.trading-tab-panel:not(.active),
.signals-view-panel:not(.active) {
  display: none;
}

.polymarket-account-page {
  display: grid;
  gap: 18px;
}

.polymarket-account-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.polymarket-account-header > div {
  display: grid;
  gap: 7px;
}

.polymarket-account-header strong {
  color: var(--text);
  font-size: 1.08rem;
  letter-spacing: 0;
}

.polymarket-account-header span:not(.chip) {
  color: var(--muted);
  line-height: 1.5;
}

.polymarket-account-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #dbe7f5;
  border-radius: 12px;
  background: #f8fbff;
}

.polymarket-account-status-grid article {
  display: grid;
  gap: 6px;
  min-height: 74px;
  padding: 14px 16px;
  border-right: 1px solid #dbe7f5;
}

.polymarket-account-status-grid article:last-child {
  border-right: 0;
}

.polymarket-account-status-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.polymarket-account-status-grid strong {
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.polymarket-account-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: start;
  padding-top: 2px;
}

.polymarket-account-form {
  display: grid;
  gap: 14px;
}

.polymarket-account-section-title {
  display: grid;
  gap: 5px;
}

.polymarket-account-section-title strong,
.polymarket-account-actions strong {
  color: var(--text);
  font-size: 0.96rem;
}

.polymarket-account-section-title span,
.polymarket-account-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.polymarket-account-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px 14px;
}

.polymarket-account-fields label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #344054;
  font-size: 0.84rem;
  font-weight: 800;
}

.polymarket-account-fields label.wide {
  grid-column: span 2;
}

.polymarket-account-fields .tg-text-input,
.polymarket-account-fields .inline-select {
  width: 100%;
  height: 42px;
}

.polymarket-account-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.polymarket-account-switches .switch-row {
  min-height: 36px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid #dbe7f5;
  border-radius: 10px;
  background: #f8fbff;
}

.polymarket-account-actions {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #dbe7f5;
  border-radius: 12px;
  background: #fbfdff;
}

.polymarket-account-actions .table-btn {
  width: 100%;
}

.polymarket-account-table-card {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.action-cell {
  display: flex;
  gap: 8px;
}

.formula-cell {
  max-width: 520px;
  white-space: normal !important;
  line-height: 1.5;
  color: #344054 !important;
}

.status-pill {
  display: inline-flex;
  min-width: 62px;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill.enabled {
  color: #006b4f;
  background: #dff8ee;
}

.status-pill.disabled {
  color: #667085;
  background: #f2f4f7;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
}

.health-pill.good {
  color: #006b4f;
  background: #dff8ee;
}

.health-pill.excellent {
  color: #ffffff;
  background: #0f8a4b;
}

.health-pill.warn {
  color: #7c4a03;
  background: #fff3cd;
}

.health-pill.danger {
  color: #9f1239;
  background: #ffe4e8;
}

.health-pill.neutral {
  color: #475467;
  background: #f2f4f7;
}

.table-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: normal;
}

.level-control-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.level-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border: 1px solid #dbe7f5;
  border-radius: 10px;
  background: #f8fbff;
}

.level-control.low {
  border-color: #fecdd3;
  background: #fff7f8;
}

.level-control strong {
  min-width: 28px;
  color: #172033;
  font-size: 0.78rem;
}

.level-control small {
  color: var(--muted);
  font-size: 0.74rem;
}

.mini-toggle {
  height: 24px;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 0 8px;
  cursor: pointer;
  font-weight: 900;
  font-size: 0.72rem;
}

.mini-toggle.mute {
  border-color: #991b1b;
  color: #ffffff;
  background: #b42318;
}

.mini-toggle.restore {
  border-color: #00a878;
  color: #006b4f;
  background: #dff8ee;
}

.danger-row td {
  background: #fff7f8;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 27, 45, 0.36);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  width: min(720px, calc(100vw - 40px));
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(24, 39, 75, 0.24);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-head strong,
.modal-head span {
  display: block;
}

.modal-head strong {
  font-size: 1.18rem;
}

.modal-head span {
  margin-top: 4px;
  color: var(--muted);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: #344054;
  background: #f2f4f7;
  cursor: pointer;
  font-size: 1.2rem;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.edit-grid label,
.params-label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-weight: 800;
}

.edit-grid .number-input {
  width: 100%;
}

.modal-params {
  width: 100%;
  min-height: 180px;
  margin-top: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.rule-grid article {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-soft);
}

.rule-grid span {
  color: var(--muted);
}

.sub-title {
  margin-top: 28px;
}

@media (max-width: 1160px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .side-card {
    position: static;
    margin-top: 14px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .topbar,
  .ops-grid,
  .polymarket-grid,
  .stat-grid,
  .stats-result-grid,
  .rule-grid,
  .tg-status-grid,
  .tg-layout,
  .tg-form-grid,
  .polymarket-account-workbench,
  .group-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .tg-status-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .polymarket-account-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .polymarket-account-status-grid article:nth-child(2) {
    border-right: 0;
  }

  .toolbar {
    min-width: 0;
  }

  .signals-table {
    min-width: 820px;
  }

  .signals-table th:nth-child(9),
  .signals-table td:nth-child(9),
  .signals-table th:nth-child(10),
  .signals-table td:nth-child(10),
  .signals-table th:nth-child(11),
  .signals-table td:nth-child(11) {
    display: none;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 14px;
  }

  .panel {
    padding: 14px;
    border-radius: 18px;
  }

  .table-toolbar {
    align-items: stretch;
  }

  .table-toolbar > div,
  .inline-filter-row,
  .inline-select {
    width: 100%;
  }

  .inline-filter-row {
    justify-content: stretch;
  }

  .tg-hero {
    display: grid;
    padding: 18px;
  }

  .tg-hero-actions {
    justify-content: stretch;
    min-width: 0;
  }

  .tg-hero-actions .table-btn,
  .tg-hero-actions .chip {
    flex: 1 1 auto;
    justify-content: center;
  }

  .tg-status-grid,
  .tg-status-cards,
  .tg-layout,
  .tg-form-grid,
  .tg-config-grid {
    grid-template-columns: 1fr;
  }

  .polymarket-account-header {
    display: grid;
  }

  .polymarket-account-status-grid,
  .polymarket-account-fields {
    grid-template-columns: 1fr;
  }

  .polymarket-account-status-grid article {
    border-right: 0;
    border-bottom: 1px solid #dbe7f5;
  }

  .polymarket-account-status-grid article:last-child {
    border-bottom: 0;
  }

  .polymarket-account-fields label.wide {
    grid-column: auto;
  }

  .polymarket-account-actions {
    padding: 12px;
  }

  .signals-table {
    min-width: 620px;
  }

  .signals-table th,
  .signals-table td {
    padding: 10px 9px;
    font-size: 0.82rem;
  }

  .signals-table th:nth-child(4),
  .signals-table td:nth-child(4),
  .signals-table th:nth-child(8),
  .signals-table td:nth-child(8),
  .signals-table th:nth-child(12),
  .signals-table td:nth-child(12) {
    display: none;
  }

  .pagination-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .pagination-controls {
    justify-content: flex-start;
    width: 100%;
  }

  .page-numbers {
    max-width: 100%;
    overflow-x: auto;
  }

  .page-size-select {
    margin-left: 0;
  }
}
