* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f6fb;
  background-image: radial-gradient(circle at 50% 0%, #ffffff 0%, #eef1f8 60%);
  color: #1a2340;
  min-height: 100vh;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
}

nav.tabs {
  display: flex;
  border-bottom: 1px solid #e2e6f0;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  z-index: 5;
}

nav.tabs a {
  flex: 1;
  text-align: center;
  padding: 15px 0;
  color: #8891ac;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  letter-spacing: 0.02em;
}

nav.tabs a.active {
  color: #0d9488;
  border-bottom-color: #0d9488;
}

main {
  padding: 16px;
}

textarea#signalInput {
  width: 100%;
  min-height: 120px;
  background: #ffffff;
  border: 1px solid #dde2ee;
  border-radius: 14px;
  color: #1a2340;
  padding: 14px;
  font-size: 16px;
  font-family: ui-monospace, Menlo, monospace;
  resize: vertical;
  box-shadow: 0 1px 3px rgba(20,30,60,0.05);
}
textarea#signalInput:focus { outline: none; border-color: #0d9488; box-shadow: 0 0 0 3px rgba(13,148,136,0.12); }

button.primary {
  width: 100%;
  margin-top: 10px;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #0d9488, #2dd4c8);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(13,148,136,0.28);
}
button.primary:disabled { opacity: 0.5; box-shadow: none; }

.msg {
  padding: 12px 0;
  border-bottom: 1px solid #edf0f7;
  font-size: 14px;
}
.msg .text { white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; color: #333d5c; }
.msg .time { color: #9aa3c0; font-size: 11px; margin-top: 4px; }

.ocr-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(13,148,136,0.08);
  border: 1px solid rgba(13,148,136,0.25);
  color: #0d9488;
  font-size: 12px;
  line-height: 1.5;
}

.pnl-bar {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e2e6f0;
  box-shadow: 0 2px 8px rgba(20,30,60,0.05);
  font-size: 17px;
  font-weight: 700;
}
.pnl-bar span.lbl { color: #8891ac; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 3px; }

.grp-label {
  font-size: 12px;
  font-weight: 700;
  color: #8891ac;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 20px 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: #4b5578;
  border-bottom: 1px solid #e2e6f0;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: 14px;
  margin-bottom: 8px;
  border: 1px solid #e6e9f2;
  border-left: 3px solid #c6cbdb;
  box-shadow: 0 2px 8px rgba(20,30,60,0.05);
}
.row.OPEN { border-left-color: #0d9488; }
.row.WAITING { border-left-color: #e08e0b; }
.row.CLOSED { border-left-color: #9aa3c0; }

.row .left { flex: 1; min-width: 0; }
.row .sym { font-weight: 700; font-size: 14.5px; color: #171e33; letter-spacing: 0.01em; }
.row .sub { color: #7986a3; font-size: 11px; margin-top: 4px; }
.row .right { text-align: right; padding-left: 12px; }

.price-pair {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 4px;
}
.price-chip {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 8px;
  white-space: nowrap;
}
.price-chip.buy { background: rgba(13,148,136,0.1); color: #0d9488; }
.price-chip.sell { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.price-chip.trigger { background: rgba(224,142,11,0.1); color: #b9740a; }
.price-chip.live { background: #f1f3f9; color: #4b5578; }

.row .pnl { font-size: 14px; font-weight: 800; margin-top: 2px; }
.row .pts { font-size: 11px; font-weight: 600; margin-top: 2px; opacity: 0.75; }

.pos { color: #0f9d63; }
.neg { color: #e0324f; }
.neu { color: #8891ac; }

.empty {
  color: #b0b6cc;
  font-size: 13px;
  padding: 16px 0;
  text-align: center;
}

.conn {
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: #e0324f; margin-right: 6px;
}
.conn.live { background: #0f9d63; }

.settings-card {
  background: #ffffff;
  border: 1px solid #e6e9f2;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(20,30,60,0.05);
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.stepper-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid #dde2ee;
  background: #f4f6fb;
  color: #0d9488;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}
.stepper-btn:active { background: #e9ecf5; }
.stepper-value { text-align: center; min-width: 100px; }
.stepper-value #lotsCount { font-size: 32px; font-weight: 800; color: #171e33; }
.stepper-sub { font-size: 12px; color: #8891ac; margin-top: 2px; }

.mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mode-label { font-size: 15px; font-weight: 800; letter-spacing: 0.03em; }
.mode-sub { font-size: 11px; color: #8891ac; margin-top: 3px; }

.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #dde2ee; border-radius: 28px; transition: 0.2s;
}
.slider::before {
  content: ""; position: absolute; height: 22px; width: 22px;
  left: 3px; bottom: 3px; background: #ffffff; border-radius: 50%; transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input:checked + .slider { background: #e0324f; }
input:checked + .slider::before { transform: translateX(22px); }

.notice {
  font-size: 12px;
  color: #b9740a;
  background: rgba(224,142,11,0.08);
  border: 1px solid rgba(224,142,11,0.25);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 4px;
  line-height: 1.5;
}

@media (max-width: 480px) {
  main { padding: 12px; }
  textarea#signalInput { min-height: 110px; font-size: 15px; padding: 12px; }
  button.primary { padding: 14px; font-size: 15px; }
  .pnl-bar { padding: 10px 12px; font-size: 15px; }
  .row { flex-direction: column; align-items: flex-start; padding: 12px; }
  .row .right { width: 100%; text-align: left; padding-left: 0; margin-top: 10px; }
  .price-pair { justify-content: flex-start; flex-wrap: wrap; }
  .row .pnl { margin-top: 6px; }
  .sym { font-size: 14px; }
  .sub { font-size: 10.5px; }
}

@media (max-width: 360px) {
  .price-chip { font-size: 11px; padding: 3px 7px; }
  nav.tabs a { font-size: 13px; padding: 13px 0; }
}
