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

:root {
  color-scheme: dark;
  --safe-top: env(safe-area-inset-top);
  --bg: #0f0e10;
  --bg-2: #171519;
  --card: #1c1a1f;
  --card-2: #222029;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #f7a21b;
  --accent-2: #ffcc6c;
  --text: #f3efe8;
  --muted: #b7b0a2;
  --muted-2: #8a8376;
  --danger: #ff7a7a;
  --success: #39d98a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

@supports (-webkit-touch-callout: none) {
  @media (display-mode: standalone), (display-mode: fullscreen) {
    :root {
      --safe-top: max(env(safe-area-inset-top), 44px);
    }
  }
}


* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "Source Han Sans TC", "Heiti TC", sans-serif;
  background: radial-gradient(circle at top, rgba(247, 162, 27, 0.15), transparent 55%),
    linear-gradient(160deg, #0e0d0f, #18161b 45%, #121015 100%);
  color: var(--text);
  min-height: 100vh;
}

html,
body {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.25;
  pointer-events: none;
  z-index: -1;
}

.app {
  max-width: 440px;
  margin: 0 auto;
  padding: 18px;
  padding-top: 0;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;
  overscroll-behavior-y: contain; /* 防止瀏覽器預設下拉刷新 */
}

.status-indicator {
  position: relative;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 0 6px transparent;
  position: absolute;
}

.status-spinner {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.1s ease;
  box-shadow: 0 0 8px var(--accent);
}

.status-spinner.ptr-refreshing {
  animation: status-breathing 1.2s ease-in-out infinite;
  opacity: 1;
}

.status-spinner:not(.hidden) {
  opacity: 1;
}

@keyframes status-breathing {
  0% { transform: scale(1); opacity: 0.8; box-shadow: 0 0 4px var(--accent); }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px var(--accent); }
  100% { transform: scale(1); opacity: 0.8; box-shadow: 0 0 4px var(--accent); }
}

.ptr-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid rgba(247, 162, 27, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  transition: transform 0.1s linear;
}

.ptr-refreshing .ptr-spinner {
  animation: ptr-spin 0.8s linear infinite;
}

@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

.safe-top {
  position: sticky;
  top: 0;
  height: calc(var(--safe-top) + 4px);
  margin: 0 -18px 8px;
  background: transparent;
  z-index: 2;
}

.hidden {
  display: none !important;
}

.auth-only .top-actions {
  display: none !important;
}

.app.auth-only + .bottom-nav {
  display: none !important;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

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

.brand-chip {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(130deg, var(--accent), #f2d36f);
  color: #2b1a00;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: 1px;
  box-shadow: var(--shadow);
}

.brand-title {
  font-weight: 700;
  font-size: 18px;
}

.brand-sub {
  color: var(--muted-2);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.status-divider {
  opacity: 0.6;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 0 6px transparent;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(57, 217, 138, 0.4);
}

.status-dot.loading {
  background: #63d6ff;
  box-shadow: 0 0 10px rgba(99, 214, 255, 0.5);
  animation: dot-pulse 1.2s ease-in-out infinite;
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255, 122, 122, 0.4);
}

@keyframes dot-pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.loading-placeholder {
  animation: pulse 1.5s ease-in-out infinite;
  color: var(--muted-2) !important;
  display: flex;
  flex-direction: column; /* 垂直排列圖示與文字，排版更平衡 */
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px 10px;
  width: 100%;
  grid-column: 1 / -1; /* 強制橫跨 Grid 所有欄位 */
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-style: normal;
  letter-spacing: 1px;
}

.loading-placeholder::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(247, 162, 27, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ptr-spin 0.8s linear infinite;
}

.status-meta {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}

.status-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 122, 122, 0.18);
  color: var(--danger);
  border: 1px solid rgba(255, 122, 122, 0.35);
  font-size: 11px;
  font-weight: 600;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topbar .chip-row {
  background: rgba(0, 0, 0, 0.25);
  padding: 2px;
  border-radius: 10px;
}

.topbar .chip {
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11px;
}

.settings-danger-zone {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.danger-btn-outline {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid rgba(255, 122, 122, 0.3);
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

@media (hover: hover) {
  .danger-btn-outline:hover {
    background: rgba(255, 122, 122, 0.1);
    border-color: var(--danger);
  }
}

.danger-btn-outline:active {
  transform: scale(0.98);
}

.ghost-btn,
.primary-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

@media (hover: hover) {
  .ghost-btn:hover,
  .primary-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }
}

.ghost-btn:active,
.primary-btn:active {
  transform: translateY(1px);
  filter: brightness(0.9);
}

.primary-btn {
  background: linear-gradient(130deg, var(--accent), #f1c357);
  color: #241300;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.ghost-btn:disabled,
.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(0.5);
}

.list-action {
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 122, 122, 0.3);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
}

@media (hover: hover) {
  .list-action:hover {
    background: rgba(255, 122, 122, 0.15);
    border-color: var(--danger);
  }
}

.list-action:active {
  transform: scale(0.95);
  background: rgba(255, 122, 122, 0.2);
}

.panel {
  animation: floatIn 0.5s ease;
}

.app.auth-only {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app.auth-only .auth-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-top: -60px; /* Offset for topbar height to make it feel more centered */
}

.auth-panel {
  margin-top: 0;
}

.card {
  background: rgba(20, 18, 24, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card.clickable {
  cursor: pointer;
}

.card.clickable:active {
  transform: scale(0.98);
  opacity: 0.9;
}

@media (hover: hover) {
  .card.clickable:hover {
    background: rgba(20, 18, 24, 0.5);
    border-color: rgba(247, 162, 27, 0.4);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  }
}

[data-sortable-group] [data-card-key] {
  cursor: grab;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

body.card-dragging {
  user-select: none;
  cursor: grabbing;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

body.drag-armed,
body.drag-armed * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.card.drag-armed,
.card.drag-armed * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.card.drag-armed,
.card.dragging {
  touch-action: none;
}

.card.dragging {
  cursor: grabbing;
  opacity: 0.92;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
}

.card-placeholder {
  width: 100%;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.auth-card {
  display: grid;
  gap: 12px;
}

.card-title {
  font-weight: 600;
  font-size: 16px;
}

.card-sub {
  color: var(--muted-2);
  font-size: 12px;
}

#recent-trades-note {
  font-size: 10px;
}


#earnings-range-meta {
  font-size: 14px;
  color: var(--muted);
  display: grid;
  gap: 4px;
  text-align: left;
  line-height: 1.3;
}

#history-range-meta {
  font-size: 14px;
  color: var(--muted);
  display: grid;
  gap: 4px;
  text-align: left;
  line-height: 1.3;
  width: 100%;
}

#earnings-range-meta .range-line strong {
  color: var(--text);
  font-weight: 600;
}

#history-range-meta .range-line strong {
  color: var(--text);
  font-weight: 600;
}

.filter-card {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.quick-ranges {
  display: flex;
  gap: 6px;
}

.range-chip {
  flex: 1;
  padding: 6px 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

@media (hover: hover) {
  .range-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
  }
}

.range-chip:active {
  background: rgba(255, 255, 255, 0.15);
}

.range-chip.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.date-input-group input[type="date"] {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  padding: 4px 0;
  width: 100%;
  outline: none;
  cursor: pointer;
}

/* 移除 Webkit 瀏覽器預設的 calendar icon 樣式 (選用) */
.date-input-group input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.5;
}

.date-sep {
  color: var(--muted-2);
  font-size: 12px;
  user-select: none;
}

.range-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.range-line {
  font-size: 12px;
  color: var(--muted-2);
  display: flex;
  gap: 4px;
  align-items: center;
}

.history-range-line {
  width: 100%;
  flex-wrap: wrap;
  gap: 8px;
}

.history-range-line > span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.history-fake-toggle {
  margin-left: auto;
}

.range-line strong {
  color: var(--text);
}

.range-actions #earnings-range-meta {
  flex: 1;
}

.range-actions #earnings-run-btn {
  margin-left: auto;
}

.range-actions #history-run-btn {
  margin-left: auto;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  position: relative;
}

.field-group-title.toggle-header {
  margin-top: 6px;
  padding-top: 4px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.tooltip-trigger {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-2);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 12px;
  transition: transform 0.2s ease, background 0.2s ease;
}

@media (hover: hover) {
  .tooltip-trigger:hover {
    color: var(--accent);
    opacity: 1;
  }
}

.tooltip-trigger:active {
  opacity: 0.6;
}

.tooltip-bubble {
  position: absolute;
  top: -6px;
  right: 0;
  transform: translateY(-100%);
  background: rgba(20, 18, 24, 0.95);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  width: min(240px, 80vw);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 5;
}

.tooltip-bubble::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: rgba(20, 18, 24, 0.95);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(-45deg);
}

.field.tooltip-open .tooltip-bubble {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-110%);
}

.field input {
  background: var(--card-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  width: 100%;
  min-width: 0;
}


.field input:focus {
  border-color: rgba(247, 162, 27, 0.6);
  box-shadow: 0 0 0 2px rgba(247, 162, 27, 0.2);
}


.hint {
  color: var(--muted-2);
  font-size: 12px;
}

.currency-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px 0;
}

.strip-label {
  font-size: 13px;
  color: var(--muted-2);
  font-weight: 500;
  opacity: 0.8;
}

.chip-row {
  display: flex;
  gap: 2px;
  background: rgba(0, 0, 0, 0.2);
  padding: 3px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.chip {
  padding: 6px 16px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .chip:hover:not(.active) {
    color: #ffffff;
  }
}

.chip:active {
  background: rgba(255, 255, 255, 0.05);
}

.chip.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.chip-icon {
  width: auto;
  height: auto;
  border-radius: 0;
  display: inline-block;
  font-size: 15px;
  font-weight: 800;
  background: transparent;
  line-height: 1;
}

.chip-icon.usd {
  color: #f7a21b;
}

.chip-icon.usdt {
  color: #26a17b;
}

.chip-icon.other {
  color: var(--muted);
}

.summary-card {
  margin: 10px 0;
  padding: 14px;
}

.summary-card.summary-toggle {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) {
  .summary-card.summary-toggle:hover {
    transform: translateY(-2px);
    border-color: rgba(247, 162, 27, 0.45);
    box-shadow: 0 12px 26px rgba(16, 11, 5, 0.35);
  }
}

.summary-card.summary-toggle:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.summary-card.mini .symbol-progress-wrapper,
.summary-card.mini .symbol-stats-grid {
  display: none;
}

.hide-summary .summary-card {
  display: none;
}

.summary-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.summary-amount {
  font-size: 28px;
  font-weight: 800;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  margin-top: 8px;
  line-height: 1.1;
}

.summary-meta {
  text-align: right;
}

.summary-meta .avg-apr-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-meta #avg-apr,
.summary-meta #symbol-avg-apr {
  font-size: 22px;
  font-weight: 800;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  line-height: 1.1;
}

.summary-card .symbol-progress-wrapper {
  margin-top: 10px;
}

.summary-card .symbol-stats-grid {
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
}

.summary-card .sym-stat {
  padding: 0;
}

.summary-grid {
  display: none; /* No longer used */
}

.meta-label {
  color: var(--muted-2);
  font-size: 11px;
}

.meta-value {
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.overview-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.overview-grid {
  display: grid;
  gap: 8px;
}

.overview-block {
  padding: 12px;
}

.overview-block.clickable {
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) {
  .overview-block.clickable:hover {
    background: rgba(255, 255, 255, 0.04);
  }
}

.overview-block.clickable:active {
  transform: translateY(1px);
  background: rgba(255, 255, 255, 0.08);
}

.overview-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.market-info-footer {
  font-size: 11px;
  color: var(--muted-2);
  text-align: right;
  opacity: 0.8;
  font-family: "IBM Plex Mono", monospace;
}

#tradepool-coverage {
  font-weight: 600;
  letter-spacing: -0.2px;
}

.overview-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.overview-metric {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.overview-metric.clickable {
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) {
  .overview-metric.clickable:hover {
    background: rgba(255, 255, 255, 0.06);
  }
}

.overview-metric.clickable:active {
  transform: translateY(1px);
  background: rgba(255, 255, 255, 0.1);
}

/* Color accents for metrics */
.overview-metric:nth-child(1) { /* FRR - Gold */
  border-left: 3px solid rgba(255, 204, 108, 0.8);
}
.overview-metric:nth-child(2) { /* BOOK - Green */
  border-left: 3px solid rgba(77, 214, 167, 0.8);
}
.overview-metric:nth-child(3) { /* MAX - Red */
  border-left: 3px solid rgba(255, 122, 122, 0.8);
}
.overview-metric:nth-child(4) { /* AVG - Blue */
  border-left: 3px solid rgba(99, 214, 255, 0.8);
}

.overview-metric span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0;
}

.overview-metric strong {
  color: var(--text);
  font-weight: 700;
  font-size: 19px;
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.1;
}

/* Optional: faint background glow based on metric color */
.overview-metric:nth-child(1)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 204, 108, 0.05), transparent 60%);
  pointer-events: none;
}
.overview-metric:nth-child(2)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(77, 214, 167, 0.05), transparent 60%);
  pointer-events: none;
}
.overview-metric:nth-child(3)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 122, 122, 0.05), transparent 60%);
  pointer-events: none;
}
.overview-metric:nth-child(4)::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 214, 255, 0.05), transparent 60%);
  pointer-events: none;
}

.overview-symbols {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.symbol-card {
  padding: 10px 12px !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.symbol-card-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.symbol-card-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.symbol-code {
  font-size: 18px;
  font-weight: 800;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
}

.symbol-avg-apr {
  font-size: 16px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
}

.symbol-avg-apr .lbl {
  font-size: 11px;
  color: var(--muted-2);
  margin-right: 2px;
  font-weight: 600;
  text-transform: uppercase;
}

/* 比例進度條 */
.symbol-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.symbol-progress-bar {
  flex: 1;
  display: flex;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.symbol-progress-pct {
  font-size: 11px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  min-width: 28px;
  text-align: right;
  opacity: 0.8;
}

.symbol-progress-bar > div {
  height: 100%;
  transition: width 0.5s ease;
}

.bar-lent { background: #39d98a; box-shadow: 0 0 10px rgba(57, 217, 138, 0.2); }
.bar-offer { background: var(--accent); }
.bar-avail { background: rgba(255, 255, 255, 0.15); }

/* 數據網格 */
.symbol-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 2px;
  align-items: center;
}

.sym-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 4px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.sym-stat .lbl {
  font-size: 12px;
  color: var(--muted-2);
  margin-right: 1px;
  font-weight: 600;
  flex-shrink: 0;
}

.sym-stat.clickable {
  cursor: pointer;
}

@media (hover: hover) {
  .sym-stat.clickable:hover {
    background: rgba(255, 255, 255, 0.08);
  }
}

.sym-stat .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.lent { background: #39d98a; box-shadow: 0 0 4px #39d98a; }
.dot.offer { background: var(--accent); box-shadow: 0 0 4px var(--accent); }
.dot.avail { background: rgba(255, 255, 255, 0.4); }

.sym-stat .cnt {
  font-size: 11px;
  color: var(--muted-2);
  margin-left: -2px;
}

@media (max-width: 380px) {
  .symbol-stats-grid {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .sym-stat {
    padding: 2px 4px;
  }
}

.symbol-card:not(.highlights-card) {
  background: var(--card-2);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.symbol-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.symbol-code {
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  color: var(--text);
}

.symbol-util {
  color: var(--accent-2);
  font-size: 15px;
  font-weight: 500;
}

.symbol-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: var(--muted-2);
  line-height: 1.5;
  padding: 4px 6px;
}

.symbol-row.symbol-action {
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

@media (hover: hover) {
  .symbol-row.symbol-action:hover {
    background: rgba(255, 255, 255, 0.04);
  }
}

.symbol-row.symbol-action:active {
  background: rgba(255, 255, 255, 0.08);
}

.symbol-row span:last-child {
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  font-size: 16px;
}

.stat-card {
  padding: 14px;
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.segment-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 8px 0 6px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}


.segment-btn {
  border: none;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  background: transparent;
  color: var(--muted-2);
  transition: all 0.2s ease;
}


.segment-btn.active {
  color: #2b1a00;
  background: linear-gradient(130deg, var(--accent), #f4d98c);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.subtabs-container {
  margin-bottom: 8px;
}

.subtabs-header {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  position: relative;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  width: 100%;
}

#lending-subtabs {
  grid-template-columns: repeat(4, 1fr);
}

.subtab-label {
  text-align: center;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s ease;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.subtab-label.active {
  color: var(--text);
}

.subtab-indicator {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--accent);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
  box-shadow: 0 0 8px rgba(247, 162, 27, 0.4);
}

.settings-subtabs {
  margin-top: 0;
}

#settings-subtabs {
  grid-template-columns: repeat(3, 1fr);
}

.settings-pages,
.lending-pages {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 0;
  scrollbar-width: none;
}

.settings-pages::-webkit-scrollbar,
.lending-pages::-webkit-scrollbar {
  display: none;
}

.settings-page,
.lending-page {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding-bottom: 4px;
}

.lending-page {
  min-height: 80vh;
}

.page-dots {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.page-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 0;
}

.page-dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(247, 162, 27, 0.18);
}

.tab-btn {
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  padding: 12px 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: #2b1a00;
  background: linear-gradient(130deg, var(--accent), #f4d98c);
  font-weight: 600;
}

.tab-panel {
  display: grid;
  gap: 8px;
  animation: floatIn 0.4s ease;
}

.tab-panel .card + .card {
  margin-top: 8px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-head.panel-center {
  justify-content: center;
}

.offers-actions {
  margin: 12px 0;
}

.offers-manual-card {
  margin-top: 12px;
}

.collapsible {
  padding: 0;
}

.collapsible-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 16px 18px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.collapsible-head .card-title {
  margin: 0;
}

.collapsible-icon {
  font-size: 16px;
  color: var(--muted-2);
  transition: transform 0.2s ease;
}

.collapsible-body {
  padding: 0 18px 18px;
  display: grid;
  gap: 12px;
}

.manual-offer-grid {
  display: grid;
  gap: 12px;
}

.manual-offer-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}

.manual-offer-row-quick {
  align-items: center;
}

.quick-amount-buttons {
  display: flex;
  width: 100%;
  gap: 8px;
}

.quick-amount-btn {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-amount-btn.active {
  color: #2b1a00;
  border-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(130deg, var(--accent), #f4d98c);
}

.quick-amount-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

@media (hover: hover) {
  .quick-amount-btn:hover:not(:disabled) {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.09);
  }

  .quick-amount-btn.active:hover:not(:disabled) {
    color: #2b1a00;
    background: linear-gradient(130deg, #f8ad29, #f4d98c);
  }
}

.field.field-grow {
  flex: 1;
  min-width: 0;
}

#offer-amount-input {
  width: 100%;
  min-width: 0;
}

.collapsible.collapsed .collapsible-body {
  display: none;
}

.collapsible.collapsed .collapsible-icon {
  transform: rotate(-90deg);
}


.list {
  display: grid;
  gap: 6px;
}

.list-header {
  display: grid;
  grid-template-columns: 90px 1fr 85px 55px;
  gap: 10px;
  margin-bottom: 6px;
}

.card + .list-header {
  margin-top: 16px;
}

.list-header.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.list-header.three-col {
  grid-template-columns: 90px 1fr 85px;
}

.list-col {
  background: transparent;
  border: none;
  color: var(--muted-2);
  font-size: 11px;
  padding: 8px 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  font-weight: 500;
  letter-spacing: 0.3px;
}

@media (hover: hover) {
  .list-col:hover {
    color: var(--text);
  }
}

.list-col:active {
  opacity: 0.7;
}

.list-header .list-col:first-child {
  text-align: left;
  padding-left: 0;
}

.list-header .list-col:not(:first-child) {
  text-align: right;
  padding-right: 0;
}

.list-col.static {
  cursor: default;
}

.list-col.active {
  color: #ffffff;
  background: transparent;
  font-weight: 700;
}

.earnings-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr 85px;
  gap: 10px;
  align-items: center;
  padding: 8px 4px;
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.earnings-row span:first-child {
  color: #ffffff;
  justify-self: start;
}

.earnings-row .earnings-row-amount,
.earnings-row .earnings-row-apr,
.earnings-row .earnings-row-funds {
  justify-self: end;
}

.earnings-row .earnings-row-apr {
  font-weight: 600;
}

#earnings-sort {
  grid-template-columns: 90px 1fr 1fr 85px;
}

.history-row {
  display: grid;
  gap: 2px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

#history-sort {
  grid-template-columns: 90px 1fr 85px 55px 42px;
}

#history-sort .list-col:last-child {
  text-align: center;
}

.history-row-main {
  display: grid;
  grid-template-columns: 90px 1fr 85px 55px 42px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.history-row-main span:first-child {
  color: #ffffff;
  justify-self: start;
}

.history-row-main .history-row-amount {
  justify-self: end;
}

.history-row-main .history-row-apr,
.history-row-main span:nth-child(4) {
  justify-self: end;
}

.history-row-main .history-row-apr {
  font-weight: 600;
}

.history-row-main span:last-child {
  justify-self: center;
}

.history-flag {
  font-weight: 700;
  font-size: 13px;
}

.history-flag.real {
  color: var(--success);
}

.history-flag.fake {
  color: var(--danger);
}

.history-flag.unknown {
  color: var(--muted-2);
}

.history-row-sub {
  font-size: 11px;
  color: var(--muted-2);
  display: flex;
  justify-content: space-between;
  padding-left: 0;
}

.lending-row {
  display: grid;
  gap: 2px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.lending-row-main {
  display: grid;
  grid-template-columns: 90px 1fr 85px 55px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.lending-row-main span:first-child {
  color: #ffffff;
  justify-self: start;
}

.lending-row-main .lending-row-amount {
  justify-self: end;
}

.lending-row-main .lending-row-apr {
  justify-self: end;
  font-weight: 600;
}

.lending-row-main span:nth-child(4) {
  justify-self: end;
}

.lending-row-sub {
  font-size: 11px;
  color: var(--muted-2);
  display: flex;
  justify-content: space-between;
}

.offers-row {
  display: grid;
  gap: 2px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.offers-row-main {
  display: grid;
  grid-template-columns: 90px 1fr 85px 55px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.offers-row-main span:first-child {
  color: #ffffff;
  justify-self: start;
}

.offers-row-main .offers-row-amount {
  justify-self: end;
}

.offers-row-main .offers-row-apr,
.offers-row-main span:nth-child(4) {
  justify-self: end;
}

.offers-row-main .offers-row-apr {
  font-weight: 600;
}

.offers-row-sub {
  font-size: 11px;
  color: var(--muted-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-item {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
}

.list-item.list-empty {
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.list-title {
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}

.list-sub {
  color: var(--muted-2);
  font-size: 12px;
}

.list-action {
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 122, 122, 0.3);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
}

@media (hover: hover) {
  .list-action:hover {
    background: rgba(255, 122, 122, 0.15);
    border-color: var(--danger);
  }
}

.list-action:active {
  transform: scale(0.95);
  background: rgba(255, 122, 122, 0.2);
}

.list-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.list-pager .ghost-btn {
  padding: 8px 12px;
  font-size: 12px;
}

.list-pager .ghost-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.pager-meta {
  font-size: 12px;
  color: var(--muted-2);
  text-align: center;
  flex: 1;
}

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

.date-grid .field input[type="date"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 4px 4px;
}

.date-grid .field {
  min-width: 0;
}

.action-card .form-grid .field input {
  max-width: 180px;
}

.form-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-card {
  display: grid;
  gap: 10px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.settings-card #save-settings-btn {
  margin-top: 8px;
}

.settings-sections {
  display: grid;
  gap: 10px;
}

.settings-section {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.settings-section-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.settings-section-title {
  display: grid;
  gap: 2px;
  text-align: left;
}

.settings-section-head .card-title {
  margin: 0;
  font-size: 15px;
}

.settings-section-head .card-sub {
  margin: 0;
  font-size: 11px;
  color: var(--muted-2);
}

.settings-section-icon {
  font-size: 16px;
  color: var(--muted-2);
  transition: transform 0.2s ease;
}

.settings-section-body {
  padding: 8px 14px 12px;
  display: grid;
  gap: 8px;
  max-height: 2000px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.3s ease;
}

.settings-section-body .form-grid {
  margin: 4px 0 0;
}

.settings-section.collapsed .settings-section-body {
  max-height: 0;
  opacity: 0;
  padding: 0 14px;
}

.settings-section.collapsed .settings-section-head {
  border-bottom-color: transparent;
}

.settings-section.collapsed .settings-section-icon {
  transform: rotate(-90deg);
}

.settings-subsection {
  border: none;
  border-left: 2px solid rgba(247, 162, 27, 0.26);
  border-radius: 0;
  background: transparent;
  padding-left: 10px;
  overflow: hidden;
}

.settings-subsection + .settings-subsection {
  margin-top: 6px;
}

.settings-subsection[data-state-key="hdas-arm"] {
  border-left-color: rgba(74, 222, 128, 0.42);
}

.settings-subsection[data-state-key="hdas-fire"] {
  border-left-color: rgba(251, 146, 60, 0.45);
}

.settings-subsection[data-state-key="short-settings"] {
  border-left-color: rgba(96, 165, 250, 0.46);
}

.settings-subsection-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.settings-subsection-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.2px;
  color: var(--muted);
}

.settings-subsection-icon {
  font-size: 14px;
  color: var(--muted-2);
  transition: transform 0.2s ease;
}

.settings-subsection-body {
  padding: 2px 0 8px;
  display: grid;
  gap: 6px;
  max-height: 1200px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease;
}

.settings-subsection-body .form-grid {
  margin: 4px 0 0;
}

.settings-subsection.collapsed .settings-subsection-body {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

.settings-subsection.collapsed .settings-subsection-icon {
  transform: rotate(-90deg);
}

.settings-section[data-state-key="hdas"] .settings-section-body {
  gap: 4px;
}

.settings-section .field input {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.07);
}

.settings-section .toggle-field {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.07);
}


.toggle-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  grid-column: 1 / -1;
  color: var(--text);
}

.field-group-title {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 10px 0 2px;
  padding-left: 10px;
  border-left: 2px solid rgba(247, 162, 27, 0.45);
  line-height: 1.35;
}

.field-group-title.toggle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  padding-right: 8px;
  transition: background 0.2s ease;
}

.field-group-title.toggle-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.settings-section[data-state-key="telegram"] .telegram-sub-field {
  padding-left: 14px;
}

.settings-subsection[data-state-key="hdas-arm"] .form-grid > .field {
  padding-left: 14px;
}

.field-group-title.toggle-header input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
  appearance: auto;
  -webkit-appearance: auto;
}

.field-group-title.toggle-header input[type="checkbox"]::before {
  display: none;
}

.settings-subsection-body .form-grid > .field-group-title:first-child {
  margin-top: 0;
}

.field-group-divider {
  grid-column: 1 / -1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 2px 0 4px;
}

/* 讓 checkbox 樣式通用化 */
.toggle-field > input[type="checkbox"] {
  width: 42px;
  height: 24px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  margin: 0;
}

.toggle-field > input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f5f1ea;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.toggle-field > input[type="checkbox"]:checked {
  background: linear-gradient(130deg, var(--accent), #f4d98c);
  border-color: rgba(255, 255, 255, 0.2);
}

.toggle-field > input[type="checkbox"]:checked::before {
  transform: translateX(18px);
}

.toggle-field .field-label {
  margin: 0;
  color: var(--text);
  justify-content: flex-start;
  gap: 8px;
}

.settings-card .toggle-field {
  padding: 8px 10px;
}

.strategy-toggle-row {
  grid-column: 1 / -1;
}

.strategy-toggle-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.toggle-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.toggle-pill input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-pill span {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease,
    background 0.2s ease, border-color 0.2s ease;
}

.toggle-pill input[type="checkbox"]:checked + span {
  background: linear-gradient(130deg, var(--accent), #f4d98c);
  color: #2b1a00;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 12px rgba(247, 162, 27, 0.35);
}

.toggle-pill input[type="checkbox"]:focus-visible + span {
  outline: 2px solid rgba(247, 162, 27, 0.45);
  outline-offset: 2px;
}

@media (hover: hover) {
  .toggle-pill:hover span {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.2);
  }
}

.toggle-pill:active span {
  transform: scale(0.98);
}

.action-card {
  background: linear-gradient(160deg, rgba(247, 162, 27, 0.2), rgba(28, 26, 31, 1));
}

.earnings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin: 8px 0 12px 0;
}

.earnings-card {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  background: transparent;
}

.earnings-card:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 20%;
  bottom: 20%;
  width: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.earnings-card .meta-label:first-child {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.6;
}

.earnings-value {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.earnings-card .meta-label:last-child {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  opacity: 1;
}

.earnings-card.up .meta-label:last-child {
  color: var(--success);
}

#market-subtabs {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 12px;
}

.market-pages {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 0;
  scrollbar-width: none;
}

.market-pages::-webkit-scrollbar {
  display: none;
}

.market-page {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 16px; /* 統一間距 */
  align-content: start;
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding-bottom: 20px;
  min-height: 80vh;
}

.market-page > .card {
  width: 100%;
  margin-top: 0 !important; /* 抵消 .card + .card 的影響 */
  margin-bottom: 0 !important;
}

.market-book-card,
.market-trades-card {
  padding: 16px;
}

.market-trades-card {
  position: relative;
}

.market-book-card {
  padding: 12px;
}

.market-book-list {
  display: grid;
  gap: 4px;
}

/* 掛單簿統計資訊優化 */
#market-book-meta {
  margin: 0 0 12px 0;
}

.market-book-summary-grid {
  display: grid;
  gap: 12px;
}

/* 強化版狀態列 - 現在作為頂部概覽 */
.market-book-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px;
  font-size: 11px; /* 稍微調小一點標籤，讓數值更突出 */
  color: var(--muted);
}

.market-book-status-bar strong {
  color: var(--success);
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  margin: 0 4px 0 2px;
  font-weight: 700;
}

.market-book-status-bar .update-time {
  color: var(--muted-2);
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

/* 移除已棄用的樣式 */
.market-book-top-header,
.market-book-summary-row,
.market-book-summary-note {
  display: none;
}


@media (min-width: 480px) {
  .market-book-summary-row {
    grid-template-columns: repeat(2, 1fr); /* 保持兩列以節省垂直空間 */
  }
}

/* 增強進度條視覺深度 */
.market-book-wall-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--success);
  opacity: 0.2; /* 稍微調深一點 */
  transition: width 0.4s ease-out;
  pointer-events: none;
}

.market-book-wall-group[data-type="walls"] .market-book-wall-bar {
  background: var(--accent-2);
  opacity: 0.2;
}


@media (min-width: 480px) {
  .market-book-summary-row {
    grid-template-columns: repeat(4, 1fr);
  }
}

.market-book-summary-row .meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  border: 1px solid var(--border);
  min-width: 0;
}

.market-book-summary-row .meta-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-book-summary-row .meta-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.2;
}

.market-book-summary-row .meta-note {
  font-size: 10px;
  color: var(--muted-2);
  font-family: "IBM Plex Mono", monospace;
  margin-top: 2px;
}

.market-book-summary-row .meta-value.highlight {
  color: var(--success);
}

.market-book-wall-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.market-book-wall-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 4px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.market-book-wall-group-title .main-label {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.market-book-wall-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.market-book-wall-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.01);
  overflow: hidden;
}

.market-book-wall-chip strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--success);
  font-family: "IBM Plex Mono", monospace;
  z-index: 1;
  width: 70px; /* 固定利率寬度以便對齊 */
}

.market-book-wall-group[data-type="walls"] .market-book-wall-chip strong {
  color: var(--accent-2);
}

.market-book-wall-chip .amt {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  z-index: 1;
  font-family: "IBM Plex Mono", monospace;
}

/* 視覺化進度條 */
.market-book-wall-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--success);
  opacity: 0.15;
  transition: width 0.4s ease-out;
  pointer-events: none;
  border-right: 2px solid rgba(var(--success-rgb), 0.3);
}

.market-book-wall-group[data-type="walls"] .market-book-wall-bar {
  background: var(--accent-2);
  border-right: 2px solid rgba(255, 193, 7, 0.3);
}

/* 隱藏不需要的細節 */
.market-book-wall-chip .details,
.market-book-wall-rank {
  display: none;
}

.market-book-summary-note {
  font-size: 10px;
  color: var(--muted-2);
  text-align: center;
  padding: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 4px;
}

.market-book-head,
.market-book-row {
  display: grid;
  grid-template-columns: 50px 80px 1fr 70px;
  gap: 10px;
  align-items: center;
  padding: 6px 0;
}

.market-book-head {
  font-size: 11px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 6px;
}

.market-book-row {
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.market-book-head span,
.market-book-row span {
  white-space: nowrap;
  justify-self: end;
}

.market-book-head span:first-child,
.market-book-row span:first-child {
  justify-self: start;
}

.market-book-row span:first-child {
  color: #ffffff;
  font-weight: 500;
}

/* 強化掛單利率 */
.market-book-row span:nth-child(2) {
  color: var(--accent-2);
  font-weight: 600;
}

.market-book-row .muted {
  color: var(--muted-2);
}

.market-book-row .direction-pill {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.market-book-row .direction-pill small {
  opacity: 0.8;
  font-size: 10px;
  margin-right: 1px;
}

.market-trades-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.market-trade-head,
.market-trade-row {
  display: grid;
  grid-template-columns: 50px 1fr 75px 45px 50px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
}

#market-trades-sort {
  grid-template-columns: 50px 1fr 75px 45px 50px;
}

.market-trade-head {
  font-size: 11px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 6px;
}

.market-trade-row {
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.market-trade-head span,
.market-trade-row span {
  white-space: nowrap;
  justify-self: end;
}

.market-trade-head span:first-child,
.market-trade-row span:first-child {
  justify-self: start;
}

.market-trade-row span:first-child {
  color: #ffffff;
  font-weight: 500;
}

/* 強化數值顯示 */
.market-trade-row span:nth-child(2) {
  font-weight: 600;
  color: var(--text);
}

.market-trade-row span:nth-child(3) {
  color: var(--accent-2);
  font-weight: 600;
}

/* 成交列表統計資訊優化 */
#market-trades-meta {
  margin: 0 0 16px 0;
}

.market-trades-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.02);
}

.market-trades-summary-row .meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.market-trades-summary-row .meta-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  opacity: 0.9;
}

.market-trades-summary-row .meta-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  line-height: 1;
}

.market-trades-summary-row .meta-value.highlight {
  color: var(--accent);
}

.market-trades-skeleton-block,
.market-trades-skeleton-line {
  display: inline-block;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: transparent;
  animation: pulse 1.3s ease-in-out infinite;
}

.market-trades-skeleton-block {
  min-height: 1em;
}

.market-trades-skeleton-count {
  width: 34px;
}

.market-trades-skeleton-amount {
  width: 72px;
}

.market-trades-skeleton-apr {
  width: 54px;
}

.market-trades-skeleton-min {
  width: 66px;
}

.market-trade-row-skeleton span {
  color: transparent;
  line-height: 1;
}

.market-trades-skeleton-time {
  width: 34px;
}

.market-trades-skeleton-value {
  width: 82px;
}

.market-trades-skeleton-rate {
  width: 46px;
}

.market-trades-skeleton-period {
  width: 24px;
}

.market-trades-skeleton-total {
  width: 28px;
}

.market-trades-skeleton-pager {
  width: 110px;
  height: 12px;
}

.tradepool-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tp-row {
  display: grid;
  grid-template-columns: 75px 1fr 70px 50px;
  align-items: center;
  padding: 5px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.2s ease;
}

.tp-row:last-child {
  border-bottom: none;
}

.tp-row:not(.tp-overall):nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

.tp-row.tp-overall {
  background: rgba(247, 162, 27, 0.04);
  border-bottom: 1px solid rgba(247, 162, 27, 0.1);
}

.tp-col-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.tp-overall .tp-col-label {
  color: var(--accent-2);
  opacity: 1;
}

.tp-col-apr {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.tp-overall .tp-col-apr {
  color: var(--accent);
  font-size: 16px;
}

.tp-col-vol {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
}

.tp-col-cnt {
  font-size: 10px;
  color: var(--muted-2);
  text-align: right;
  font-weight: 500;
}

.tp-row.short .tp-col-apr { color: #63d6ff; }
.tp-row.mid .tp-col-apr { color: #39d98a; }
.tp-row.long .tp-col-apr { color: #b085ff; }


.tradepool-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}


.tradepool-card {
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.tradepool-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  opacity: 0.8;
}

.rate-distribution-card {
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.rate-distribution-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  border-top: 2px solid #63d6ff;
  border-left: 2px solid #63d6ff;
  opacity: 0.8;
}

.rate-distribution-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.rate-dist-row {
  display: grid;
  grid-template-columns: 68px repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 6px;
  min-width: 360px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.rate-dist-row:last-child {
  border-bottom: none;
}

.rate-dist-row:not(.rate-dist-header):nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

.rate-dist-header {
  background: rgba(255, 255, 255, 0.04);
}

.rate-dist-label,
.rate-dist-metric,
.rate-dist-value {
  font-family: "IBM Plex Mono", monospace;
  text-align: center;
}

.rate-dist-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
  text-align: left;
}

.rate-dist-metric {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.4px;
}

.rate-dist-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.rate-dist-row.short .rate-dist-value { color: #63d6ff; }
.rate-dist-row.mid .rate-dist-value { color: #39d98a; }
.rate-dist-row.long .rate-dist-value { color: #b085ff; }

.hdas-card {
  padding: 14px;
}

.hdas-card .list {
  margin-top: 8px;
}

.hdas-status-badge {
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.hdas-status-fire {
  background: rgba(255, 122, 122, 0.2);
  color: var(--danger);
  border: 1px solid rgba(255, 122, 122, 0.4);
}

.hdas-status-whale {
  background: rgba(103, 186, 255, 0.18);
  color: #a6e0ff;
  border: 1px solid rgba(103, 186, 255, 0.38);
}

.hdas-status-arm {
  background: rgba(57, 217, 138, 0.15);
  color: var(--success);
  border: 1px solid rgba(57, 217, 138, 0.35);
}

.hdas-status-short {
  background: rgba(99, 214, 255, 0.16);
  color: #8ee4ff;
  border: 1px solid rgba(99, 214, 255, 0.35);
}

.hdas-status-fallback {
  background: rgba(255, 193, 92, 0.16);
  color: #ffd38a;
  border: 1px solid rgba(255, 193, 92, 0.35);
}

.hdas-status-disarm {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted-2);
  border: 1px solid var(--border);
}

.hdas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0 8px;
}

.hdas-content.hdas-single-rate .hdas-grid {
  grid-template-columns: 1.1fr 0.9fr;
  column-gap: 8px;
}

.hdas-content.hdas-multi-rate .hdas-grid {
  grid-template-columns: 1.3fr 0.7fr;
  column-gap: 16px;
}

.hdas-metric {
  display: flex;
  flex-direction: column;
}

.hdas-metric-label {
  font-size: 11px;
  color: var(--muted-2);
  margin-bottom: 2px;
}

.hdas-metric-value {
  font-size: 16px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  line-height: 1.2;
}

.hdas-metric-value.fire-text {
  color: var(--danger);
  font-size: 16px;
  line-height: 1.3;
}

.hdas-footer {
  font-size: 11px;
  color: var(--muted-2);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  line-height: 1.4;
}

.hdas-compare-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
  padding: 6px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.whale-rush-content {
  gap: 0;
}

.whale-rush-banner {
  margin: 2px 0 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(103, 186, 255, 0.18), rgba(103, 186, 255, 0.08));
  border: 1px solid rgba(103, 186, 255, 0.22);
  color: #d9f3ff;
  font-size: 12px;
  line-height: 1.45;
}

.short-minefield-section {
  margin-bottom: 6px;
  padding: 4px 0 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.short-minefield-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 6px;
}

.short-minefield-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.short-minefield-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.short-minefield-tier {
  color: var(--accent);
  text-transform: uppercase;
}

.short-minefield-period {
  color: var(--muted-2);
}

.short-minefield-apr {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  margin-top: 2px;
}

.hdas-compare-row {
  display: grid;
  grid-template-columns: 78px 12px 1fr 20px 12px 1.1fr;
  align-items: center;
  font-size: 11px;
  gap: 0 2px;
  line-height: 1.2;
}

.hdas-compare-label {
  color: var(--text);
  font-weight: 600;
  opacity: 0.9;
}

.hdas-dot {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 12px;
  font-size: 6px;
  color: var(--accent);
}

.hdas-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: "IBM Plex Mono", monospace;
  white-space: nowrap;
}

.hdas-tag {
  display: inline-block;
  width: 32px;
  flex-shrink: 0;
  opacity: 0.8;
}

.hdas-compare-row:nth-child(2) .hdas-tag {
  width: 32px;
}

.hdas-item.selected {
  color: var(--text);
  font-weight: 600;
}

.hdas-item.dimmed {
  color: var(--muted);
  opacity: 0.85;
}

.hdas-vs {
  font-size: 9px;
  color: var(--muted-2);
  opacity: 0.7;
  text-align: center;
}

.hdas-score {
  font-size: 10px;
  opacity: 0.8;
}

.hdas-footer strong {
  color: var(--text);
}

/* 隱藏冗餘元素以實現無縫整合 */
.highlights-divider, 
.highlights-history-title { 
  display: none !important; 
}

.highlights-card {
  padding: 10px 12px;
  position: relative;
  overflow: hidden;
}

.highlights-recent-grid {
  min-height: 84px;
}

.highlights-history-grid {
  min-height: 22px;
}

/* 左上角科技感標記 */
.highlights-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  opacity: 0.8;
}

.hl-compact-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.hl-main-item {
  display: flex;
  flex-direction: column;
}

.hl-label {
  font-size: 9px;
  color: var(--muted-2);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.hl-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.hl-value.hl-apr {
  font-size: 22px;
  color: var(--accent-2);
  letter-spacing: -0.5px;
}

.hl-compact-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.hl-sub-left {
  display: flex;
  align-items: center;
}

.hl-sub-text {
  font-size: 12px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.2px;
}

.hl-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--success);
  border-radius: 50%;
  margin-right: 8px;
  box-shadow: 0 0 4px var(--success);
}

.hl-loading .hl-dot {
  opacity: 0.35;
  box-shadow: none;
}

.hl-skeleton-block,
.hl-skeleton-line {
  display: inline-block;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: transparent;
  animation: pulse 1.3s ease-in-out infinite;
}

.hl-skeleton-block {
  min-width: 44px;
  min-height: 1em;
}

.hl-skeleton-apr {
  width: 76px;
  height: 26px;
}

.hl-skeleton-count {
  width: 28px;
}

.hl-skeleton-line {
  height: 12px;
}

.hl-skeleton-line-long {
  width: 148px;
}

.hl-skeleton-line-short {
  width: 58px;
}

/* 歷史高點條狀化 */
.hl-highs-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 2px;
}

.hl-high-item {
  display: flex;
  gap: 4px;
  align-items: center;
}

.hl-high-h {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted-2);
}

.hl-high-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted-2);
  margin-right: 4px;
}

.hl-high-v {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
}

.hl-skeleton-high {
  width: 40px;
  height: 14px;
}

.hl-sep {
  color: rgba(255, 255, 255, 0.1);
  font-size: 10px;
}

@media (max-width: 360px) {
  .hl-value.hl-apr { font-size: 18px; }
  .hl-value { font-size: 13px; }
  .hl-sub-text { font-size: 9px; }
}

.tradepool-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.tradepool-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.tradepool-title {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.tradepool-value {
  font-size: 14px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}

.tradepool-meta {
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 4px;
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(247, 162, 27, 0.2);
  color: var(--accent-2);
  font-size: 12px;
  text-transform: uppercase;
}

.chart-card {
  padding: 14px;
  padding-top: 10px;
}

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

canvas {
  width: 100%;
  height: 180px;
  border-radius: 12px;
  background: rgba(12, 11, 14, 0.6);
}

#market-chart {
  height: 210px;
}

.chart-legend {
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 12px;
}

.chart-key {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 10px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.chart-key-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-key-name {
  font-weight: 700;
  color: #ffffff;
  width: 46px;
}

.chart-key-text {
  font-weight: 700;
  width: 64px;
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
}


.chart-swatch {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: #f7a21b;
}

.chart-swatch.top {
  background: transparent;
  border-top: 2px dashed #4dd6a7;
  height: 0;
}

.chart-swatch.frr {
  background: transparent;
  border-top: 2px dashed rgba(255, 204, 108, 0.9);
  height: 0;
}

.chart-swatch.max {
  background: rgba(255, 122, 122, 0.9);
}

.chart-swatch.avg {
  background: rgba(99, 214, 255, 0.9);
}


.toast {
  position: fixed;
  bottom: calc(90px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 26, 31, 0.96);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(440px, 100%);
  padding: 10px 18px calc(12px + env(safe-area-inset-bottom));
  background: rgba(16, 14, 18, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.35);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  z-index: 10;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.nav-item.active {
  background: transparent;
  color: var(--accent);
  font-weight: 500;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.nav-label {
  font-size: 10px;
  line-height: 1;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 420px) {
  canvas {
    height: 140px;
  }

  .list-pager {
    gap: 8px;
  }

  .list-pager .ghost-btn {
    padding: 6px 10px;
  }

  .form-grid.two-col {
    gap: 8px;
    grid-template-columns: 1fr;
  }

  .quick-amount-btn {
    padding: 7px 8px;
    font-size: 11px;
  }

  .form-grid.two-col .field input[type="date"] {
    padding: 8px 10px;
    font-size: 12px;
  }

  .date-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 8px;
  }

  .date-grid .field {
    min-width: 0;
  }

  .date-grid .field input[type="date"] {
    max-width: 100%;
    padding: 6px 6px;
    font-size: 11px;
  }

  .summary-grid {
    display: none;
  }

  .symbol-action-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .market-book-head,
  .market-book-row {
    grid-template-columns: 42px 70px 1fr 60px;
    gap: 6px;
    font-size: 11px;
  }

  .market-trade-head,
  .market-trade-row {
    grid-template-columns: 40px 1fr 65px 40px 45px;
    gap: 4px;
    font-size: 11px;
  }

  #market-trades-sort {
    grid-template-columns: 40px 1fr 65px 40px 45px;
    gap: 4px;
  }

  .earnings-row {
    grid-template-columns: 80px 1fr 1fr 72px;
    padding: 6px 4px;
    font-size: 12px;
  }

  #earnings-sort {
    grid-template-columns: 80px 1fr 1fr 72px;
  }

  .list-header {
    grid-template-columns: 80px 1fr 80px 50px;
    gap: 8px;
  }

  #history-sort {
    grid-template-columns: 80px 1fr 80px 50px 36px;
  }

  .list-header .list-col:first-child {
    padding-left: 0;
  }

  .list-header .list-col:not(:first-child) {
    padding-right: 0;
  }

  .history-row-main {
    grid-template-columns: 80px 1fr 80px 50px 36px;
    gap: 8px;
    font-size: 12px;
  }

  .history-flag {
    font-size: 12px;
  }

  .lending-row-main {
    grid-template-columns: 80px 1fr 80px 50px;
    gap: 8px;
    font-size: 12px;
  }

  .offers-row-main {
    grid-template-columns: 80px 1fr 80px 50px;
    gap: 8px;
    font-size: 12px;
  }

  .history-row-sub {
    font-size: 10px;
  }

  .settings-card {
    gap: 8px;
    padding: 0;
  }

  .settings-sections {
    gap: 8px;
  }

  .settings-section-head {
    padding: 11px 12px;
  }

  .settings-section-body {
    padding: 6px 10px 10px;
    gap: 6px;
  }

  .settings-section.collapsed .settings-section-body {
    padding: 0 10px;
  }

  .settings-section-body .form-grid {
    gap: 8px;
    margin: 4px 0 0;
  }

  .settings-subsection {
    padding-left: 8px;
  }

  .settings-subsection-head {
    padding: 6px 0;
  }

  .settings-subsection-body {
    padding: 2px 0 8px;
  }

  .settings-subsection.collapsed .settings-subsection-body {
    padding: 0;
  }

  .settings-card .toggle-field {
    padding: 7px 8px;
  }

  .settings-subsection[data-state-key="hdas-arm"] .form-grid > .field {
    padding-left: 10px;
  }

  .strategy-toggle-buttons {
    gap: 8px;
  }

  .toggle-pill span {
    padding: 4px 8px;
  }
}

.instant-activity-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-2);
}

.instant-activity-label-row span:last-child {
  color: var(--text);
}

/* 各色系定義 */
.status-green { color: var(--success); }
.status-green-bg { background: linear-gradient(90deg, #2ecc71, var(--success)); box-shadow: 0 0 15px rgba(46, 204, 113, 0.3); }
.status-yellow { color: var(--accent); }
.status-yellow-bg { background: linear-gradient(90deg, #f1c40f, var(--accent)); box-shadow: 0 0 15px rgba(241, 196, 15, 0.3); }
.status-red { color: var(--danger); }
.status-red-bg { background: linear-gradient(90deg, #e74c3c, var(--danger)); box-shadow: 0 0 15px rgba(231, 76, 60, 0.3); }
.status-blue { color: #3498db; }
.status-blue-bg { background: linear-gradient(90deg, #2980b9, #3498db); box-shadow: 0 0 15px rgba(52, 152, 219, 0.3); }
