/* CSS completo para el último HTML */
* {
  box-sizing: border-box;
}

:root {
  --bg: #05070d;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.11);
  --text: #f6f8ff;
  --muted: #9ea9c7;
  --green: #28e6a0;
  --blue: #2f80ff;
  --red: #ff4d6d;
  --yellow: #ffd166;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(47, 128, 255, 0.32), transparent 32%),
    radial-gradient(circle at top right, rgba(40, 230, 160, 0.18), transparent 28%),
    linear-gradient(135deg, #080d18, #05070d 55%, #02030a);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  color: #061018;
  background: linear-gradient(135deg, #28e6a0, #7dffd4);
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
  box-shadow: 0 14px 34px rgba(40, 230, 160, 0.18);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  opacity: 0.88;
}

.secondary {
  background: linear-gradient(135deg, #2f80ff, #7ab2ff);
  color: white;
}

.danger {
  background: linear-gradient(135deg, #ff4d6d, #ff8ba0);
  color: white;
  box-shadow: 0 14px 34px rgba(255, 77, 109, 0.18);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.075);
  color: #dce5ff;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.full {
  width: 100%;
}

.hidden {
  display: none !important;
}

input,
select {
  width: 100%;
  max-width: 100%;
  padding: 14px 15px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.26);
  color: #fff;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(40, 230, 160, 0.12);
}

label {
  display: block;
  margin: 18px 0 8px;
  color: #dce5ff;
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

p {
  margin-bottom: 0;
}

.row {
  display: flex;
  align-items: center;
}

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

.message {
  min-height: 22px;
  color: var(--yellow);
  font-size: 14px;
}

.muted {
  color: var(--muted);
  margin: 6px 0 0;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  color: #7fffd7;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* SHELL */

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 26px;
  background: rgba(5, 7, 13, 0.72);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 60;
  overflow-y: auto;
}

.main {
  min-width: 0;
  padding: 30px;
}

/* SIDEBAR */

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px;
  box-shadow: 0 0 28px rgba(47, 128, 255, 0.22);
}

.brand h1 {
  font-size: 20px;
  margin: 0;
}

.brand p {
  color: var(--muted);
  margin: 6px 0 0;
}

.user-box {
  margin-top: 28px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.user-box span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.user-box strong {
  display: block;
  word-break: break-all;
  margin: 6px 0 14px;
}

.sidebar-menu {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.sidebar-menu .tab {
  width: 100%;
  min-height: 50px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.065);
  color: #dce5ff;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 17px;
}

.sidebar-menu .tab.active {
  background: linear-gradient(135deg, rgba(40, 230, 160, 0.95), rgba(121, 255, 209, 0.95));
  color: #061018;
  box-shadow: 0 10px 28px rgba(40, 230, 160, 0.18);
}

.tab-icon {
  font-size: 17px;
}

.side-note {
  margin-top: 20px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(40, 230, 160, 0.08);
  border: 1px solid rgba(40, 230, 160, 0.13);
}

.side-note strong {
  color: #8fffd6;
}

.side-note p {
  color: var(--muted);
  margin-top: 6px;
  font-size: 14px;
}

/* CARD */

.card {
  background: linear-gradient(180deg, var(--panel-strong), rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

/* AUTH */

.auth-layout {
  max-width: 1080px;
  margin: 5vh auto;
  display: grid;
  grid-template-columns: 1fr 460px;
  gap: 20px;
  align-items: stretch;
}

.welcome-panel {
  padding: 36px;
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(47, 128, 255, 0.18), rgba(40, 230, 160, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.welcome-panel::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -70px;
  bottom: -70px;
  border-radius: 50%;
  background: rgba(40, 230, 160, 0.13);
  filter: blur(12px);
}

.welcome-icon {
  width: 88px;
  height: 88px;
  object-fit: contain;
  margin-bottom: 20px;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.welcome-title {
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1;
  margin-bottom: 12px;
}

.welcome-animated {
  color: #dce5ff;
  font-size: 18px;
  max-width: 540px;
}

.welcome-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.welcome-pills span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #dce5ff;
  font-weight: 800;
}

.auth-card {
  padding: 26px;
}

/* DASHBOARD */

.dashboard {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: 36px;
  margin-bottom: 4px;
}

.badge {
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 950;
  letter-spacing: 0.08em;
  font-size: 12px;
  white-space: nowrap;
}

.badge.off {
  background: rgba(255, 77, 109, 0.2);
  color: #ff9daf;
}

.badge.on {
  background: rgba(40, 230, 160, 0.2);
  color: #6fffc8;
}

/* DETAILS */

.settings-card,
.collapse-card {
  padding: 0;
  margin-bottom: 18px;
}

.settings-card summary,
.collapse-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
}

.settings-card summary::-webkit-details-marker,
.collapse-card > summary::-webkit-details-marker {
  display: none;
}

.summary-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: #dce5ff;
  transition: transform 0.2s ease;
}

.settings-card[open] .summary-icon,
.collapse-card[open] .summary-icon {
  transform: rotate(180deg);
}

.settings-content,
.collapse-content {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px 24px 24px;
}

.summary-metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.summary-metrics span {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 94px;
  padding: 9px 12px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
}

.summary-metrics strong {
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

/* CONTROL */

.control-card {
  border-color: rgba(40, 230, 160, 0.18);
  box-shadow:
    var(--shadow),
    0 0 48px rgba(40, 230, 160, 0.08);
}

.bot-actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr 0.75fr;
  gap: 12px;
  margin-bottom: 18px;
}

.bot-actions button {
  min-height: 64px;
}

.start-main {
  font-size: 17px;
}

/* WALLET */

.wallet-card {
  border-color: rgba(47, 128, 255, 0.14);
}

.wallet-summary-area {
  min-width: 320px;
  display: grid;
  gap: 10px;
}

.wallet-summary {
  justify-content: flex-start;
}

.wallet-summary span {
  min-width: 115px;
}

.sparkline {
  width: 100%;
  height: 110px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.sparkline path {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px rgba(40, 230, 160, 0.42));
}

.pill {
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.pill.on {
  background: rgba(40, 230, 160, 0.16);
  color: #8fffd6;
}

.pill.off {
  background: rgba(255, 255, 255, 0.08);
  color: #aeb9d7;
}

/* METRICS */

.metrics {
  display: grid;
  gap: 14px;
}

.metrics.mini {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wallet-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metrics div {
  min-width: 0;
  padding: 16px;
  border-radius: 19px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 19px;
  word-break: break-word;
}

.signal.buy,
.positive,
.log-line.buy,
.log-line.win {
  color: #6fffc8 !important;
}

.signal.sell,
.negative,
.log-line.loss,
.log-line.error {
  color: #ff9daf !important;
}

.signal.hold,
.neutral {
  color: #dce5ff !important;
}

/* SETTINGS */

.form-grid {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1fr;
  gap: 14px;
}

.risk-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}

.switch-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.switch-line input {
  width: auto;
}

.configured {
  margin-top: 14px;
  color: #a7f3d0;
  font-size: 14px;
}

.key-item {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 10px 13px;
  border-radius: 999px;
  background: rgba(40, 230, 160, 0.09);
  border: 1px solid rgba(40, 230, 160, 0.13);
  margin: 5px 6px 0 0;
}

.key-item strong {
  color: #dce5ff;
  font-size: 12px;
}

/* TABLES / LOGS */

.history-card,
.log-card,
.document-card {
  margin-top: 18px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

.side {
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
}

.side.buy {
  background: rgba(40, 230, 160, 0.14);
  color: #6fffc8;
}

.side.sell {
  background: rgba(255, 77, 109, 0.14);
  color: #ff9daf;
}

.log-box {
  height: 350px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.28);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.log-line {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #dbe7ff;
  word-break: break-word;
}

.log-line.warn {
  color: #ffd166;
}

/* CONFIG / DOCUMENT */

.config-card,
.document-card {
  padding: 26px;
}

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

.config-actions {
  margin-top: 18px;
}

.rich-doc {
  margin-top: 18px;
  color: #dce5ff;
  line-height: 1.65;
}

.rich-doc h1,
.rich-doc h2,
.rich-doc h3 {
  color: white;
}

.rich-doc a {
  color: #6fffc8;
}

#syncText {
  color: #8fffd6;
}

/* MODALS */

.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 24px;
  background: #101827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

.alert-modal-card {
  border-color: rgba(40, 230, 160, 0.22);
  box-shadow:
    var(--shadow),
    0 0 44px rgba(40, 230, 160, 0.12);
}

.modal-card code {
  display: block;
  margin: 14px 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  color: #6fffc8;
}

/* RESPONSIVE */

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .sidebar {
    padding: 20px;
  }

  .main {
    padding: 22px;
  }

  .auth-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .config-grid,
  .wallet-metrics,
  .metrics.mini {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collapse-card > summary,
  .settings-card summary {
    grid-template-columns: minmax(200px, 1fr) auto;
  }

  .summary-metrics,
  .wallet-summary-area,
  .summary-action {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .wallet-summary-area {
    min-width: 0;
  }
}

@media (max-width: 850px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    padding: 12px 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 7, 13, 0.95);
    overflow: visible;
  }

  .brand-img {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .brand p,
  .side-note {
    display: none;
  }

  .user-box {
    margin-top: 10px;
    padding: 12px;
    border-radius: 16px;
  }

  .sidebar-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
    gap: 8px;
  }

  .sidebar-menu .tab {
    justify-content: center;
    min-height: 46px;
    padding: 0 8px;
    font-size: 12px;
  }

  .sidebar-menu .tab-icon {
    display: none;
  }

  .main {
    padding: 14px;
  }

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

  .topbar h2 {
    font-size: 28px;
  }

  .badge {
    width: 100%;
    text-align: center;
  }

  .card {
    border-radius: 20px;
  }

  .settings-card summary,
  .collapse-card > summary {
    padding: 16px;
  }

  .settings-content,
  .collapse-content {
    padding: 14px 16px 16px;
  }

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

  .bot-actions button {
    min-height: 56px;
  }

  .metrics.mini,
  .wallet-metrics,
  .config-grid {
    grid-template-columns: 1fr;
  }

  .summary-metrics {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-metrics span {
    min-width: 0;
  }

  .sparkline {
    height: 115px;
  }

  .log-box {
    height: 300px;
    font-size: 12px;
  }
}

@media (max-width: 520px) {
  .main {
    padding: 10px;
  }

  .auth-card,
  .config-card,
  .document-card {
    padding: 18px;
  }

  .welcome-panel {
    padding: 26px;
  }

  .welcome-title {
    font-size: 38px;
  }

  .row.gap {
    align-items: stretch;
  }

  .row.gap button {
    width: 100%;
  }

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

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

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

  .metrics strong {
    font-size: 17px;
  }

  table {
    min-width: 700px;
  }

  .log-box {
    height: 260px;
  }
}