:root {
  --bg: #f6f8f7;
  --text: #18312c;
  --muted: #607c75;
  --surface: #ffffff;
  --line: #d6e2de;
  --accent: #0f766e;
  --accent-soft: #d9f3ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Cambria, "Book Antiqua", "Palatino Linotype", Palatino, serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 0% -10%, #e7f4ef 0%, transparent 70%),
    radial-gradient(1200px 600px at 100% -20%, #edf8f5 0%, transparent 65%),
    var(--bg);
}

.shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.actions {
  display: flex;
  gap: 10px;
}

.botServiceControl {
  display: grid;
  justify-items: center;
  flex: 1;
  gap: 10px;
}

.serviceToggle {
  min-width: 160px;
  font-weight: 700;
  border-width: 2px;
  letter-spacing: 0.02em;
  font-size: 1.08rem;
  padding: 12px 20px;
  border-radius: 14px;
}

.serviceToggleStop {
  background-color: #b91c1c !important;
  border-color: #7f1018 !important;
  color: #fff6f6 !important;
  box-shadow: 0 10px 24px rgba(127, 16, 24, 0.25);
}

.serviceToggleStop:hover {
  background-color: #991b1b !important;
}

.serviceToggleStart {
  background-color: #16a34a !important;
  border-color: #166534 !important;
  color: #f3fff7 !important;
  box-shadow: 0 10px 24px rgba(22, 101, 52, 0.22);
}

.serviceToggleStart:hover {
  background-color: #15803d !important;
}

.serviceTogglePendingStop,
.serviceTogglePendingStart {
  background-color: #374151 !important;
  border-color: #1f2937 !important;
  color: #f8fafc !important;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.2);
}

.serviceToggleUnknown {
  background-color: #f7fbfa !important;
  color: var(--text) !important;
}

.linkBtn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

h1 {
  margin: 0;
  letter-spacing: 0.3px;
}

.sub {
  margin-top: 8px;
  color: var(--muted);
}

.modePill {
  margin-top: 10px;
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  background: #f7fbfa;
}

.modePaper {
  color: #166534;
  background: #e9f9ee;
  border-color: #b7e4c0;
}

.modeLive {
  color: #9a3412;
  background: #fff1e7;
  border-color: #ffd0b1;
}

.modeStopped {
  color: #374151;
  background: #eef2f7;
  border-color: #cbd5e1;
}

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.btn:hover {
  background: #f0f6f4;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(14, 63, 54, 0.06);
}

.card h2,
.raw h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #0f5f56;
}

.card p {
  margin: 0;
  line-height: 1.5;
}

.statusList {
  display: grid;
  gap: 6px;
  line-height: 1.5;
}

.wide {
  grid-column: 1 / -1;
}

.listBlock {
  display: grid;
  gap: 10px;
}

.tradeItem {
  border: 1px solid #dfe8e3;
  border-radius: 12px;
  padding: 12px;
  background: #fcfdfc;
}

.tradeMain {
  font-weight: 600;
  margin-bottom: 4px;
}

.tradeSub {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.spotBig {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.legGrid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 2.6fr 0.7fr 0.9fr 0.9fr 0.9fr;
  gap: 6px 10px;
  align-items: start;
}

.legHead {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.legCell {
  font-size: 0.9rem;
  line-height: 1.35;
}

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

.sideBadge {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 700;
  color: #fff;
  font-size: 0.85rem;
}

.badgeBuy {
  background: #4a9f2b;
}

.badgeSell {
  background: #df4b53;
}

.tabBar {
  margin-top: 8px;
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.tabBtn {
  border: none;
  background: #f4f8f6;
  color: var(--muted);
  font: inherit;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

.tabBtn:hover {
  background: #ebf3ef;
}

.tabActive {
  background: #dff1ea;
  color: #145e55;
}

.tabPane {
  display: none;
  margin-top: 10px;
}

.paneActive {
  display: block;
}

.pnlTable {
  display: grid;
  grid-template-columns: 3.5fr 0.8fr 1fr 1fr 1fr;
  gap: 8px 10px;
  align-items: center;
}

.closedPnlTable {
  margin-top: 6px;
}

.pnlHead {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7b76;
  font-weight: 600;
  border-bottom: 1px solid #e4ece8;
  padding-bottom: 6px;
}

.tradeFooter {
  margin-top: 10px;
  font-weight: 600;
}

.pnlPos {
  color: #2f8f31;
  font-weight: 600;
}

.pnlNeg {
  color: #d8454d;
  font-weight: 600;
}

.payoffWrap {
  border: 1px solid #e5ede9;
  border-radius: 10px;
  padding: 10px;
  background: #fbfdfc;
}

.payoffSvg {
  width: 100%;
  height: 220px;
  display: block;
}

.payoffAxis {
  stroke: #c7d5cf;
  stroke-width: 1;
}

.payoffLine {
  fill: none;
  stroke: #0b8f2f;
  stroke-width: 2;
}

.spotMarker {
  stroke: #2a61d8;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.spotLabel {
  fill: #2a61d8;
  font-size: 11px;
  font-weight: 600;
}

.payoffLabel {
  fill: #6b7b76;
  font-size: 11px;
}

.payoffMeta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.closedTable {
  display: grid;
  grid-template-columns: 1.2fr 2.2fr 1fr 1fr 0.9fr;
  gap: 8px 10px;
  align-items: center;
}

.closedHead {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7b76;
  font-weight: 600;
  border-bottom: 1px solid #e4ece8;
  padding-bottom: 6px;
}

.closedRowBtn {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: inherit;
  gap: 8px 10px;
  align-items: center;
  font: inherit;
  border: 1px solid #e3ebe7;
  border-radius: 10px;
  background: #fcfdfc;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.closedRowBtn:hover {
  background: #f3f9f6;
  border-color: #d4e4de;
}

.closedCell {
  font-size: 0.92rem;
  line-height: 1.35;
}

.closedMuted {
  color: var(--muted);
}

.closedDetail {
  grid-column: 1 / -1;
  display: none;
  border: 1px solid #e3ebe7;
  border-radius: 10px;
  background: #ffffff;
  padding: 10px;
}

.closedDetail.open {
  display: block;
}

.closedMoreWrap {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.configWrap {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

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

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

.field label {
  font-size: 0.9rem;
  color: var(--muted);
}

.field input,
.field select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
}

.weekdayGroup {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weekdayChip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #f8fcfb;
  font-size: 0.9rem;
}

.weekdayChip input {
  margin-right: 6px;
}

.configActions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.saveNote {
  margin-top: 8px;
  color: var(--muted);
}

.liveLockWarning {
  display: none;
  margin-top: 6px;
  border: 1px solid #f0b4ad;
  border-radius: 10px;
  padding: 10px 12px;
  color: #b42318;
  background: #fff1f0;
  font-weight: 700;
  line-height: 1.45;
}

.liveLockWarning.show {
  display: block;
}

@media (max-width: 760px) {
  .top {
    flex-direction: column;
    align-items: stretch;
  }

  .botServiceControl {
    order: -1;
  }

  .actions {
    justify-content: flex-start;
  }

  .desktopOnly {
    display: none;
  }

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

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

  .pnlTable,
  .closedTable,
  .closedRowBtn {
    grid-template-columns: 1.6fr 0.8fr 1fr 1fr 0.9fr;
    font-size: 0.86rem;
  }
}
