@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

:root {
  --font-sans: "Inter", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Roboto Mono", monospace;
  font-family: var(--font-sans);
  color: #e2e8f0;
  background-color: #05080f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.15), transparent 40%),
    linear-gradient(135deg, #05080f, #0f172a 60%, #05080f);
  color: #e2e8f0;
  font-family: var(--font-sans);
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
  /* Increased line height for readability */
}

/* Typography Enhancements */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.025em;
  /* Tighter headings */
  color: #fff;
}

.subtitle,
label,
th,
.section-head .subtle-tip {
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  /* Spaced out labels */
  font-size: 0.75rem;
  /* Smaller, punchier */
  font-weight: 600;
  color: #64748b;
  /* Muted tech color */
}

/* Monospace Data Application */
td,
input,
select,
textarea,
.latency-status,
.pnl-text,
#live-holding-count,
#live-pending-count,
#live-pnl,
#paper-holding-count,
#paper-pending-count,
#paper-pnl,
#history-total-pnl,
#history-total-fee,
#history-win-rate,
.history-page-info {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" on, "zero" on;
  /* Tabular numbers & Slashed zero */
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
}

.sidebar {
  width: 230px;
  background: rgba(10, 12, 26, 0.85);
  backdrop-filter: blur(10px);
  color: white;
  padding: 36px 26px;
  border-right: 1px solid rgba(148, 163, 184, 0.2);
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  margin: 0 0 24px;
  height: 40px;
  width: auto;
  display: block;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-item {
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  transition: transform 0.2s ease, color 0.2s ease, border 0.2s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(16, 185, 129, 0.35));
  color: #fff;
  font-weight: 600;
  border-color: rgba(148, 163, 184, 0.4);
}

.sidebar-note {
  margin-top: auto;
  padding: 14px 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.05), rgba(59, 130, 246, 0.02));
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  text-align: center;
}

.sidebar-note p {
  margin: 0;
}

.sidebar-note p+p {
  margin-top: 6px;
}

main {
  flex: 1;
  padding: 48px;
  margin-left: 230px;
}

.brand-hero {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(15, 23, 42, 0.88);
  border-radius: 22px;
  padding: 14px 18px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.2);
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.brand-hero::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25), transparent 70%);
  right: -120px;
  top: -100px;
}

.brand-identity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  z-index: 1;
}

.brand-title {
  margin: 0;
  display: flex;
  justify-content: center;
}

.brand-text {
  text-align: center;
}

.brand-title-img {
  width: 460px;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 30px rgba(37, 99, 235, 0.3));
}

.brand-logo {
  width: 175px;
  height: 175px;
  border-radius: 8px;
  object-fit: contain;
  image-rendering: pixelated;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.brand-subtitle {
  margin: 12px 0 0;
  color: #94a3b8;
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.subtitle {
  margin: 0;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
}

h1 {
  margin: 6px 0 0;
  font-size: 30px;
}

.card-block {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 18px;
  padding: 24px 28px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.55);
  margin-bottom: 28px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.card-block h2 {
  margin-top: 0;
}

.connection-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.connection-card {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 22px;
  padding: 24px 22px;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  background: rgba(9, 13, 26, 0.8);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.connection-card>*:nth-child(1) {
  /* logo */
  margin-top: 4px;
}

.connection-card h3 {
  margin: 8px 0 8px;
  font-size: 20px;
}

.connection-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.3), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.connection-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.6);
  border-color: rgba(96, 165, 250, 0.7);
}

.connection-card:hover::before {
  opacity: 1;
}

.connection-card h3 {
  margin: 10px 0 8px;
  font-size: 20px;
}

.card-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  object-fit: contain;
  filter: drop-shadow(0 8px 25px rgba(0, 0, 0, 0.5));
}

.toggle-row {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.permission-warning {
  min-height: 22px;
  margin: 2px 0 12px;
  color: #fca5a5;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.toggle-switch {
  width: 62px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.7);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-switch.loading,
.toggle-switch:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.toggle-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.5);
  transition: transform 0.2s ease;
}

.toggle-switch.active {
  background: linear-gradient(135deg, #22d3ee, #10b981);
  border-color: rgba(45, 212, 191, 0.9);
}

.toggle-switch.active span {
  transform: translateX(30px);
  background: #fff;
}

.ghost-btn,
.btn {
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 10px;
  padding: 10px 16px;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: #e2e8f0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.btn {
  background: linear-gradient(135deg, #1e3a8a, #172554);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.6);
  filter: brightness(1.15);
}

.btn:active {
  transform: scale(0.98);
  box-shadow: 0 0 5px rgba(37, 99, 235, 0.4);
  filter: brightness(0.9);
}

.btn.danger {
  background: linear-gradient(135deg, #dc2626, #991b1b);
}

.btn.danger:hover {
  filter: brightness(1.2);
}

.ghost-btn:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(148, 163, 184, 0.08);
}

.config-btn {
  min-width: 80px;
  padding: 8px 12px;
}

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

.history-head {
  flex-wrap: wrap;
  gap: 12px;
}

.history-controls {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.history-controls label {
  color: #94a3b8;
  font-size: 14px;
}

.history-controls select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
}

.history-controls input[type="date"] {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
}

.history-date {
  position: relative;
}

#history-date-toggle {
  width: 140px;
  height: 40px;
  padding: 0 16px;
  /* Match custom select width */
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  color: #e2e8f0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

#history-date-toggle:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(15, 23, 42, 0.8);
}

.calendar-icon {
  color: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

.history-date-panel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  width: 240px;
  /* Wider for inputs */
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1100;
  animation: slideDown 0.2s ease-out;
}

.history-date-panel.hidden {
  display: none;
}

.panel-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-row label {
  min-width: 36px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
}

.history-date-panel input[type="date"] {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(10, 15, 30, 0.6);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  color-scheme: dark;
  /* Forces browser date picker to be dark */
  transition: border-color 0.2s;
}

.history-date-panel input[type="date"]:focus {
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(10, 15, 30, 0.8);
}

.history-date-panel input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.8;
  color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
  width: 20px;
  height: 20px;
}

.history-date-panel input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.history-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

/* 日志查看 */
.log-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.log-auto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  font-size: 13px;
}

.log-panel {
  background: rgba(9, 13, 26, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 12px;
  max-height: 520px;
  overflow: auto;
  font-family: "JetBrains Mono", Menlo, Consolas, monospace;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4);

  /* Scrollbar */
  scrollbar-color: rgba(59, 130, 246, 0.45) rgba(15, 23, 42, 0.5);
}

.log-panel::-webkit-scrollbar {
  width: 6px;
}

.log-panel::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 999px;
}

.log-panel::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.8), rgba(16, 185, 129, 0.8));
  border-radius: 999px;
}

#log-content {
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

.history-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.line-long-short-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.line-long-short-container .chart-card:first-child {
  flex: 1;
  min-height: 200px;
}

.line-long-short-container .chart-card:last-child {
  flex: 1;
  min-height: 200px;
}

.history-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 18px 0 6px;
}

.metric-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 16px 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.metric-card p {
  color: #94a3b8;
  margin-bottom: 6px;
}

.metric-card h3 {
  margin: 0;
  font-size: 1.8rem;
  color: #f8fafc;
}

.chart-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  min-height: 200px;
}

#history-line-chart {
  margin-top: 25px;
}

.pie-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 16px;
  padding-bottom: 24px;
}

.pie-card canvas {
  margin-top: 32px;
  margin-bottom: 24px;
}

.chart-card-title {
  margin-bottom: 10px;
  font-weight: 600;
  color: #e2e8f0;
}

.history-charts .chart-card.bar-card {
  grid-column: span 2;
  min-height: unset !important;
  display: flex;
  flex-direction: column;
}

.bar-chart-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  padding-bottom: 8px;
  scrollbar-color: rgba(59, 130, 246, 0.45) rgba(15, 23, 42, 0.5);
  max-height: 400px;
}

.bar-chart-wrapper canvas {
  width: 100% !important;
  display: block;
  margin-top: 10px;
}

.bar-chart-wrapper::-webkit-scrollbar {
  width: 6px;
}

.bar-chart-wrapper::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 999px;
}

.bar-chart-wrapper::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.8), rgba(16, 185, 129, 0.8));
  border-radius: 999px;
}

.long-short-chart-wrapper {
  width: 100%;
  overflow: hidden;
  padding: 0;
}

.long-short-chart-wrapper canvas {
  width: 100% !important;
  display: block;
  margin-top: 25px;
  height: auto !important;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: #f1f5f9;
  min-width: 760px;
}

th,
td {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  text-align: center;
  vertical-align: middle;
  font-size: 13px;
}

th {
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-size: 12px;
}

td.empty {
  text-align: center;
  color: #94a3b8;
}

.direction-long {
  color: #34d399;
  font-weight: 600;
}

.direction-short {
  color: #f87171;
  font-weight: 600;
}

.exchange-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
  position: relative;
  top: 2px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.75);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 16px;
  backdrop-filter: blur(8px);
  z-index: 1000;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: rgba(10, 15, 30, 0.95);
  border-radius: 18px;
  padding: 28px;
  width: min(520px, 95%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.modal-content input,
.modal-content select,
.modal-content textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
}

.toggle-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 6px;
}

.toggle-field label {
  margin: 0;
}

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

.table-actions button {
  margin-right: 6px;
}

#status-message {
  min-height: 20px;
}

#status-message.success {
  color: #34d399;
}

#status-message.error {
  color: #f87171;
}

.page-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-section.hidden {
  display: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.summary-card {
  background: rgba(9, 13, 26, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
}

.summary-card p {
  margin: 0;
  color: #94a3b8;
  font-size: 14px;
}

.summary-card h3 {
  margin: 10px 0 0;
  font-size: 30px;
}

.subtle-tip {
  color: #94a3b8;
  font-size: 14px;
}

.card-block.inner {
  margin-top: 12px;
}

.table-wrapper {
  overflow-x: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin: 2px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.badge.hit {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
}

.badge.tp {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.5);
}

.plan-item {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-width: 96px;
  border-radius: 999px;
  overflow: visible;
  border: 1px solid rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: inset 0 0 6px rgba(59, 130, 246, 0.1);
  position: relative;
}

.plan-item.active {
  border-color: rgba(16, 185, 129, 0.65);
  background: rgba(16, 185, 129, 0.15);
  box-shadow: inset 0 0 8px rgba(16, 185, 129, 0.2);
}

.plan-item.hit {
  border-color: rgba(52, 211, 153, 0.65);
  background: rgba(52, 211, 153, 0.18);
  box-shadow: inset 0 0 10px rgba(52, 211, 153, 0.25);
}

.plan-list {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.plan-index {
  min-width: 22px;
  padding: 3px 0;
  text-align: center;
  font-size: 11px;
  color: #e2e8f0;
  border-right: 1px solid rgba(148, 163, 184, 0.35);
}

.plan-value {
  flex: 1;
  padding: 4px 10px;
  font-size: 12px;
  color: #e2e8f0;
  text-align: center;
}

.pnl-text {
  transition: color 0.2s ease;
}

.pnl-positive {
  color: #34d399;
}

.pnl-negative {
  color: #f87171;
}

.status-label {
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.status-label.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.45);
}

.plan-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.edit-pill-btn {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  padding: 5px 6px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.edit-pill-btn:hover {
  border-color: rgba(16, 185, 129, 0.7);
  color: #34d399;
}

.price-modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 4px;
}

.price-modal-body label {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 4px;
}

.price-modal-body input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.35);
  color: #e2e8f0;
}

.price-modal-body input:disabled {
  color: #94a3b8;
  border-style: dashed;
  background: rgba(100, 116, 139, 0.15);
}

/* 操作按钮样式 */
.action-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.action-btn:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: #60a5fa;
  transform: translateY(-1px);
}

.close-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.close-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
}

.cancel-btn {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.3);
}

.cancel-btn:hover {
  background: rgba(249, 115, 22, 0.3);
  border-color: #f97316;
}

/* 原文跳转按钮 - 浅黄色 */
.origin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  background: rgba(250, 204, 21, 0.12);
  color: #fbbf24;
  border-color: rgba(250, 204, 21, 0.35);
  text-decoration: none;
}

.origin-btn:hover {
  background: rgba(250, 204, 21, 0.28);
  border-color: #fbbf24;
  color: #fde68a;
}

.origin-btn svg {
  display: block;
}

/* 数量列 - 固定宽度 */
.col-qty {
  width: 80px;
  max-width: 80px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 编辑图标样式 */
.edit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-left: 6px;
  background: rgba(34, 211, 153, 0.2);
  border: 1px solid rgba(34, 211, 153, 0.4);
  border-radius: 4px;
  color: #22d3ee;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: bold;
}

.edit-icon:hover {
  background: rgba(34, 211, 153, 0.4);
  border-color: #22d3ee;
  transform: scale(1.1);
}

/* Latency Status */
.latency-status {
  position: absolute;
  top: 111px;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
  white-space: nowrap;
}

.latency-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #64748b;
  transition: all 0.3s ease;
}

.latency-status.good {
  color: #34d399;
}

.latency-status.good::before {
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

.latency-status.warning {
  color: #facc15;
}

.latency-status.warning::before {
  background: #facc15;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.6);
}

.latency-status.bad {
  color: #f87171;
}

/* Toast Notification System */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2200;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  /* Allow clicking through container */
}

.toast {
  pointer-events: auto;
  width: 320px;
  background: rgba(15, 23, 42, 0.85);
  /* Dark Glass */
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-left: 4px solid #3b82f6;
  /* Default Blue */
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  color: #e2e8f0;
  font-family: var(--font-sans);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastSlideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: top center;
  transition: all 0.3s ease;
}

.toast.hiding {
  opacity: 0;
  transform: translateX(100%);
}

.toast-icon {
  font-size: 20px;
  line-height: 1;
  padding-top: 2px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  color: #fff;
  letter-spacing: -0.01em;
}

.toast-message {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
}

/* Toast Variants */
.toast.success {
  border-left-color: #10b981;
  /* Green */
  background: linear-gradient(to right, rgba(16, 185, 129, 0.05), rgba(15, 23, 42, 0.85) 30%);
}

.toast.success .toast-title {
  color: #34d399;
}

.toast.error {
  border-left-color: #ef4444;
  /* Red */
  background: linear-gradient(to right, rgba(239, 68, 68, 0.05), rgba(15, 23, 42, 0.85) 30%);
}

.toast.error .toast-title {
  color: #f87171;
}

.toast.warning {
  border-left-color: #f59e0b;
  /* Amber */
}

.toast.warning .toast-title {
  color: #fbbf24;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.latency-status.bad::before {
  background: #f87171;
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.6);
}

/* Modern Input Style (Matching Login Page) */
.form-control {
  background: rgba(5, 8, 15, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.875rem 1rem;
  color: #fff;
  font-size: 1rem;
  transition: all 0.2s ease;
  outline: none;
  width: 100%;
}

.form-control:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
  background: rgba(5, 8, 15, 0.8);
}

/* Channel Search & Toolbar */
.toolbar-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Noto Sans SC', monospace;
  font-size: 13px;
  width: 200px;
  transition: all 0.2s ease;
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.page-info {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Table Layout Fixes */
.notes-cell {
  width: 80px;
  /* Adjusted for ~5 chars */
  max-width: 80px;
  padding: 8px 4px;
  /* Tight padding */
}

.note-wrapper {
  display: block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  font-size: 12px;
}

.pagination-actions {
  display: flex;
  gap: 8px;
}

/* Mobile Fixes for Channel Config */
@media (max-width: 768px) {
  .section-head {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .toolbar-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-input {
    width: 100% !important;
  }

  #add-channel-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Version Alert Tag */
#version-alert-tag {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2050;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
  animation: slideInRight 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: transform 0.2s ease;
}

#version-alert-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.5);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Loading Spinner for Update */
.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: block;
}

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

/* Settings Page Layout */
.settings-grid {
  display: flex !important;
  flex-wrap: wrap;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: stretch;
}

.settings-grid .card {
  margin: 0 !important;
  flex: 1;
  min-width: 320px;
  max-width: 600px;
}

@media (max-width: 768px) {
  .settings-grid .card {
    min-width: 100%;
  }
}

/* Settings Section - No Outer Container */
.settings-section {
  padding: 0;
}

/* Make individual cards in settings visually distinct */
.settings-grid .card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 16px;
  padding: 2rem;
}

/* Global Utility Classes */
.hidden {
  display: none !important;
}

/* Custom Instant Tooltip */
.custom-tooltip {
  position: relative;
  cursor: help;
}

.custom-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(17, 24, 39, 0.95);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: normal;
  width: max-content;
  max-width: 260px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1000;
  pointer-events: none;
  line-height: 1.4;
  text-align: left;
}

/* Tooltip Arrow */
.custom-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(17, 24, 39, 0.95) transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1000;
}

.custom-tooltip:hover::after,
.custom-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Remove number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  /* Firefox */
  appearance: textfield;
}