.robot-section {
  margin: 22px 0;
  border: 1px solid rgba(98, 255, 156, 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0, rgba(54, 255, 131, 0.09), transparent 34%),
    linear-gradient(145deg, rgba(16, 25, 23, 0.98), rgba(7, 12, 11, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.robot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.robot-title-wrap,
.robot-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.robot-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #06110b;
  background: linear-gradient(135deg, #81ffad, #2fe875);
  box-shadow: 0 0 28px rgba(69, 255, 135, 0.26);
  font-weight: 900;
}

.robot-title h2,
.robot-title p {
  margin: 0;
}

.robot-title h2 {
  color: #f4fff7;
  font-size: 1.2rem;
}

.robot-title p {
  margin-top: 4px;
  color: #8ea29a;
  font-size: 0.8rem;
}

.robot-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #aebdb7;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.robot-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #78847f;
}

.robot-status.running {
  color: #7dffa9;
  border-color: rgba(58, 255, 127, 0.24);
}

.robot-status.running i {
  background: #42f783;
  box-shadow: 0 0 12px #42f783;
  animation: robotPulse 1.5s infinite;
}

.robot-status.paused {
  color: #ffd77f;
  border-color: rgba(255, 204, 87, 0.25);
}

.robot-status.paused i {
  background: #ffc85a;
}

@keyframes robotPulse {
  50% { opacity: 0.42; }
}

.robot-safety-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 24px 0;
  padding: 11px 13px;
  border: 1px solid rgba(86, 214, 255, 0.17);
  border-radius: 11px;
  color: #a9c5ba;
  background: rgba(59, 150, 183, 0.07);
  font-size: 0.76rem;
}

.robot-safety-banner strong {
  color: #b9efff;
}

.robot-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(340px, 1.35fr) minmax(270px, 1fr);
  gap: 14px;
  padding: 16px 24px 24px;
}

.robot-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

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

.robot-card h3 {
  margin: 0;
  color: #eafff0;
  font-size: 0.88rem;
}

.robot-card-head span {
  color: #718078;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.robot-form {
  display: grid;
  gap: 12px;
}

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

.robot-field label,
.robot-range-line {
  color: #8fa099;
  font-size: 0.72rem;
  font-weight: 700;
}

.robot-field select,
.robot-field input[type="number"] {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  color: #effff4;
  background: #101815;
  outline: none;
}

.robot-field select:focus,
.robot-field input:focus {
  border-color: rgba(64, 255, 132, 0.45);
  box-shadow: 0 0 0 3px rgba(64, 255, 132, 0.08);
}

.robot-range-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.robot-range-line strong {
  color: #70ffa2;
}

.robot-field input[type="range"] {
  width: 100%;
  accent-color: #46ef82;
}

.robot-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 4px;
  color: #9baba4;
  font-size: 0.7rem;
  line-height: 1.45;
}

.robot-consent input {
  margin-top: 2px;
  accent-color: #46ef82;
}

.robot-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.robot-btn {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  color: #c5d3cd;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  font-weight: 800;
}

.robot-btn:hover:not(:disabled) {
  border-color: rgba(100, 255, 155, 0.35);
  color: #fff;
}

.robot-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.robot-btn.primary {
  color: #041109;
  border-color: transparent;
  background: linear-gradient(135deg, #7cffaa, #35e878);
}

.robot-btn.danger {
  color: #ff9da7;
  border-color: rgba(255, 91, 109, 0.2);
  background: rgba(255, 74, 94, 0.07);
}

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

.robot-metric {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.robot-metric span {
  display: block;
  margin-bottom: 5px;
  color: #77867f;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.robot-metric strong {
  color: #f2fff6;
  font-size: 1rem;
}

.robot-metric strong.positive {
  color: #55f28d;
}

.robot-metric strong.negative {
  color: #ff7181;
}

.robot-chart-wrap {
  position: relative;
  height: 132px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 10px;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 100% 33%, 25% 100%;
}

#robot-chart {
  width: 100%;
  height: 100%;
}

.robot-decision {
  padding: 11px 12px;
  border-left: 3px solid #42ee80;
  border-radius: 7px;
  color: #a8b8b1;
  background: rgba(57, 239, 124, 0.055);
  font-size: 0.72rem;
  line-height: 1.5;
}

.robot-decision strong {
  color: #dffff0;
}

.robot-position {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.robot-position div {
  padding: 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.robot-position span,
.robot-position strong {
  display: block;
}

.robot-position span {
  margin-bottom: 3px;
  color: #718078;
  font-size: 0.62rem;
}

.robot-position strong {
  color: #dfffea;
  font-size: 0.75rem;
}

.robot-log {
  max-height: 334px;
  overflow: auto;
  padding-right: 5px;
}

.robot-log-item {
  position: relative;
  margin-left: 7px;
  padding: 0 0 15px 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.robot-log-item::before {
  content: "";
  position: absolute;
  top: 4px;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #74847d;
}

.robot-log-item.trade::before {
  background: #43f081;
  box-shadow: 0 0 8px rgba(67, 240, 129, 0.5);
}

.robot-log-item.risk::before {
  background: #ffba57;
}

.robot-log-item strong,
.robot-log-item span {
  display: block;
}

.robot-log-item strong {
  margin-bottom: 3px;
  color: #cde0d5;
  font-size: 0.72rem;
  line-height: 1.4;
}

.robot-log-item span {
  color: #66756e;
  font-size: 0.63rem;
}

.robot-empty {
  padding: 25px 10px;
  color: #718078;
  text-align: center;
  font-size: 0.75rem;
}

.robot-reset {
  border: 0;
  color: #7e9087;
  background: transparent;
  cursor: pointer;
  font-size: 0.67rem;
}

.robot-reset:hover {
  color: #fff;
}

@media (max-width: 1080px) {
  .robot-grid {
    grid-template-columns: 1fr 1.2fr;
  }

  .robot-card.log-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  html,
  body,
  #root,
  .terminal-shell {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .terminal-header {
    height: auto;
    min-height: 106px;
    padding: 7px 12px 0;
    flex-wrap: wrap;
    gap: 4px 10px;
  }

  .terminal-header .brand {
    height: 52px;
    min-width: 0;
    flex: 1 1 120px;
  }

  .brand img {
    width: min(128px, 100%);
  }

  .account-controls {
    flex: 0 0 auto;
    margin-left: auto;
    gap: 5px;
  }

  .account-switch button {
    padding: 6px 7px;
  }

  .account-controls select {
    width: 56px;
    padding: 0 5px;
  }

  .terminal-header nav {
    order: 3;
    display: flex;
    width: calc(100% + 24px);
    height: 43px;
    margin: 0 -12px;
    padding: 0 7px;
    gap: 2px;
    overflow-x: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    scrollbar-width: none;
  }

  .terminal-header nav::-webkit-scrollbar,
  .ticker-strip::-webkit-scrollbar,
  .chart-controls::-webkit-scrollbar,
  .analysis-toolbar::-webkit-scrollbar {
    display: none;
  }

  .terminal-header nav a {
    min-width: max-content;
    padding: 0 10px;
    white-space: nowrap;
    font-size: 11px;
  }

  .market-browser {
    padding: 20px 14px 14px;
  }

  .asset-list {
    display: grid;
    max-height: 318px;
    padding-right: 3px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .asset-row {
    width: 100%;
    min-width: 0;
    grid-template-columns: 38px minmax(0, 1fr) minmax(72px, auto);
    gap: 10px;
    padding: 10px 8px;
  }

  .asset-row > span:nth-child(2),
  .asset-row > span:nth-child(3) {
    max-width: 100%;
    overflow: hidden;
  }

  .asset-row strong,
  .asset-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .instrument-head {
    align-items: flex-start;
    gap: 10px;
  }

  .instrument-head > div:first-child {
    min-width: 0;
  }

  .instrument-head p {
    min-width: 0;
  }

  .instrument-head p strong,
  .instrument-head p small {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .live-quote {
    min-width: 100px;
    flex: 0 0 auto;
  }

  .chart-controls,
  .analysis-toolbar {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .chart-controls {
    align-items: center;
  }

  .timeframes,
  .chart-types,
  .analysis-toolbar > div {
    flex: 0 0 auto;
    min-width: max-content;
  }

  .chart-controls button,
  .analysis-toolbar button {
    white-space: nowrap;
  }

  .market-chart {
    min-height: 270px;
  }

  .portfolio-section,
  .activity-section {
    min-width: 0;
  }

  .positions-card,
  .positions-table,
  .activity-list {
    min-width: 0;
    overflow: hidden;
  }

  .table-row {
    gap: 8px;
    grid-template-columns: minmax(110px, 1.2fr) minmax(62px, .7fr) minmax(70px, 1fr);
  }

  .table-row > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .activity-list > div {
    min-width: 0;
    padding: 9px 0;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 2px 7px;
  }

  .activity-list p {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
  }

  .activity-list span {
    grid-column: 2;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .robot-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .robot-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .robot-card.log-card {
    grid-column: auto;
  }

  .robot-safety-banner {
    margin: 14px 14px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .robot-safety-banner span,
  .robot-title p,
  .robot-decision,
  .robot-log-item strong,
  .robot-position strong {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }

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

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

  footer {
    max-width: 100%;
    overflow: hidden;
  }

  footer > p,
  footer > div {
    width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 390px) {
  .terminal-header {
    padding-inline: 9px;
  }

  .terminal-header nav {
    width: calc(100% + 18px);
    margin-inline: -9px;
  }

  .brand img {
    width: 112px;
  }

  .account-switch button {
    padding-inline: 6px;
    font-size: 9px;
  }

  .account-controls select {
    width: 52px;
    font-size: 10px;
  }

  .instrument-head p strong {
    font-size: 16px;
  }

  .live-quote strong {
    font-size: 15px;
  }
}
