* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: #131722;
  color: #d1d4dc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

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

h1 { font-size: 22px; font-weight: 700; color: #fff; }

.icon-btn {
  background: #1c2030;
  border: 1px solid #2a2e39;
  color: #d1d4dc;
  font-size: 20px;
  width: 40px; height: 40px;
  border-radius: 10px;
  cursor: pointer;
}

.field { margin-bottom: 14px; }

.field label, #settingsView label {
  display: block;
  font-size: 12px;
  color: #868993;
  margin-bottom: 5px;
}

select, input {
  width: 100%;
  padding: 12px;
  background: #1c2030;
  border: 1px solid #2a2e39;
  border-radius: 8px;
  color: #d1d4dc;
  font-size: 15px;
}

.auto-mode-box {
  background: #1c2030;
  border: 1px solid #2a2e39;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.auto-mode-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 10px;
}

.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: #363a45; transition: .2s; border-radius: 26px;
}
.slider:before {
  position: absolute; content: ""; height: 20px; width: 20px;
  left: 3px; bottom: 3px; background-color: white; transition: .2s; border-radius: 50%;
}
input:checked + .slider { background-color: #26a69a; }
input:checked + .slider:before { transform: translateX(20px); }

#intervalSelect { margin-bottom: 8px; padding: 10px; font-size: 14px; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: #d1d4dc; margin: 10px 0 6px;
}
.time-range { display: flex; gap: 10px; margin-bottom: 6px; }
.time-range > div { flex: 1; }
.time-range label { font-size: 11px; color: #868993; display: block; margin-bottom: 4px; }
.time-range input[type="time"] {
  width: 100%; background: #1c2030; border: 1px solid #2a2e39; color: #fff;
  border-radius: 6px; padding: 8px; font-size: 13px;
}

.hint { font-size: 12px; color: #868993; margin: 4px 0; }
.hint.warn { color: #f0a02c; }
.hint a { color: #2962ff; }

.mtf-badge {
  background: rgba(41, 98, 255, 0.1);
  border: 1px solid rgba(41, 98, 255, 0.3);
  color: #2962ff;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
}

.primary-btn {
  width: 100%; padding: 15px;
  background: #2962ff; color: white; border: none; border-radius: 10px;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.primary-btn:disabled { background: #4a4f5c; }

.secondary-btn {
  width: 100%; padding: 13px; margin-top: 8px;
  background: transparent; color: #d1d4dc; border: 1px solid #363a45;
  border-radius: 10px; font-size: 15px; cursor: pointer;
}

.status-msg { font-size: 13px; color: #868993; margin-top: 12px; min-height: 18px; }
.status-msg.error { color: #f23645; }
.status-msg.success { color: #26a69a; }

.result-box {
  margin-top: 16px; background: #1c2030; border-radius: 10px;
  padding: 16px; border: 1px solid #2a2e39;
}
.result-box.hidden { display: none; }

.verdict-badge {
  display: inline-block; padding: 8px 16px; border-radius: 20px;
  font-weight: 700; font-size: 14px; margin-bottom: 12px;
}
.verdict-badge.apto {
  background: rgba(38,166,154,.15); color: #26a69a; border: 1px solid #26a69a;
}
.verdict-badge.no-apto {
  background: rgba(242,54,69,.15); color: #f23645; border: 1px solid #f23645;
}

.result-section { margin-top: 12px; }
.result-section h3 {
  font-size: 11px; text-transform: uppercase; color: #868993;
  margin-bottom: 5px; letter-spacing: .5px;
}
.result-section p { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }

.trade-plan {
  margin-top: 14px; background: rgba(38,166,154,.08);
  border: 1px solid rgba(38,166,154,.3); border-radius: 8px; padding: 12px 14px;
}
.trade-plan.hidden { display: none; }
.trade-plan h3 { font-size: 11px; text-transform: uppercase; color: #26a69a; margin-bottom: 8px; }
.trade-row {
  display: flex; justify-content: space-between; font-size: 14px;
  padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.05);
}
.trade-row span:first-child { color: #868993; }
.trade-row span:last-child { font-weight: 700; text-align: right; max-width: 60%; }

#historyBox { margin-top: 20px; }
#historyBox h3 { font-size: 13px; color: #868993; margin-bottom: 8px; }
.history-item {
  background: #1c2030; border: 1px solid #2a2e39; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 6px; font-size: 13px;
}
.history-item .hist-top {
  display: flex; justify-content: space-between; align-items: center;
}
.history-item .hist-verdict { font-weight: 700; }
.history-item .hist-verdict.apto { color: #26a69a; }
.history-item .hist-verdict.no-apto { color: #f23645; }
.history-item .hist-meta { color: #868993; font-size: 11px; }
.hist-plan {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed #2a2e39;
}
.hist-plan-row {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 2px 0;
}
.hist-plan-row span:first-child { color: #868993; }
.hist-plan-row span:last-child { font-weight: 600; color: #d1d4dc; }

#settingsView h2 { font-size: 17px; color: #fff; margin-bottom: 16px; }
#settingsView input, #settingsView select { margin-bottom: 4px; }
#settingsView label { margin-top: 12px; }
.settings-buttons { margin-top: 20px; }

.install-hint {
  margin-top: 24px; padding: 14px; background: #1c2030;
  border-radius: 10px; border: 1px solid #2a2e39;
}
.install-hint h3 { font-size: 13px; color: #fff; margin-bottom: 6px; }
.install-hint p { font-size: 12px; color: #868993; line-height: 1.5; }

.hidden { display: none; }

/* --- Horarios programados y registro de señales --- */
.window-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.window-row input[type="time"] { flex: 1; padding: 8px; font-size: 14px; }
.window-row span { color: #868993; font-size: 13px; }
.icon-btn.small { width: 34px; height: 34px; font-size: 14px; flex: none; }
.small-btn { padding: 10px; font-size: 13px; margin-top: 4px; }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.preset-btn {
  flex: 1; min-width: 90px; padding: 8px 6px; font-size: 12px;
  background: rgba(41, 98, 255, 0.1); color: #2962ff;
  border: 1px solid rgba(41, 98, 255, 0.3); border-radius: 8px; cursor: pointer;
}

#journalBox { margin-top: 20px; }
#journalBox h3 { font-size: 13px; color: #868993; margin-bottom: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.stat { background: #1c2030; border: 1px solid #2a2e39; border-radius: 8px; padding: 8px; text-align: center; }
.stat-value { font-size: 16px; font-weight: 700; color: #fff; }
.stat-label { font-size: 10px; color: #868993; text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.journal-actions { display: flex; gap: 6px; margin-bottom: 10px; }
.journal-actions .secondary-btn { margin-top: 0; }
.secondary-btn.danger { color: #f23645; border-color: rgba(242,54,69,.4); }
.journal-item {
  background: #1c2030; border: 1px solid #2a2e39; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 6px; font-size: 13px;
}
.journal-item .hist-top { display: flex; justify-content: space-between; align-items: center; }
.journal-item .hist-verdict { font-weight: 700; }
.journal-item .hist-verdict.apto { color: #26a69a; }
.journal-item .hist-verdict.no-apto { color: #f23645; }
.journal-item .hist-meta { color: #868993; font-size: 11px; margin-top: 2px; }
.status-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 12px; border: 1px solid #363a45; color: #d1d4dc; }
.status-badge.st-win { color: #26a69a; border-color: #26a69a; background: rgba(38,166,154,.12); }
.status-badge.st-loss { color: #f23645; border-color: #f23645; background: rgba(242,54,69,.12); }
.status-badge.st-open { color: #f0a02c; border-color: #f0a02c; background: rgba(240,160,44,.1); }
.status-badge.st-neutral { color: #868993; }
#activeHoursFields > label { display: block; font-size: 12px; color: #868993; margin: 10px 0 5px; }

.switch-row select { width: auto; padding: 6px 10px; font-size: 13px; }
.install-btn {
  width: 100%; padding: 12px; margin-bottom: 14px; font-size: 14px; font-weight: 600;
  background: rgba(38,166,154,.12); color: #26a69a; border: 1px solid #26a69a;
  border-radius: 10px; cursor: pointer;
}
.install-btn.hidden { display: none; }
