:root {
  --bg: #0a0f0a;
  --bg-card: #0f1a0f;
  --bg-section: #111a11;
  --green: #00ff88;
  --green2: #00cc66;
  --border: #1a2a1a;
  --text: #e0e0e0;
  --text-muted: #6b7c6b;
  --red: #ff4444;
  --yellow: #ffbb00;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* ─── LOGIN ─── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--green);
  border-radius: 12px;
  padding: 3rem;
  max-width: 360px;
  width: 90%;
  text-align: center;
}

.login-card h1 {
  color: var(--green);
  font-family: monospace;
  letter-spacing: 0.2em;
  font-size: 2rem;
  margin-bottom: 2rem;
}

.login-card input[type="password"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 1rem;
  outline: none;
}

.login-card input[type="password"]:focus {
  border-color: var(--green);
}

.login-card button {
  width: 100%;
  background: var(--green);
  color: #000;
  font-weight: bold;
  border: none;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.login-card button:hover { opacity: 0.85; }

#login-error {
  color: var(--red);
  margin-top: 1rem;
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* ─── HEADER ─── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

header h1 {
  color: var(--green);
  font-family: monospace;
  letter-spacing: 0.2em;
  font-size: 1.3rem;
}

#status-badge {
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-family: monospace;
  font-weight: bold;
  letter-spacing: 0.05em;
}

.badge-green {
  background: rgba(0,255,136,0.1);
  color: var(--green);
  border: 1px solid var(--green);
  animation: pulse 2s infinite;
}

.badge-red {
  background: rgba(255,68,68,0.1);
  color: var(--red);
  border: 1px solid var(--red);
}

.badge-yellow {
  background: rgba(255,187,0,0.1);
  color: var(--yellow);
  border: 1px solid var(--yellow);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 0.2s;
}

.logout-btn:hover { border-color: var(--red); color: var(--red); }

/* ─── LAYOUT ─── */
#dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ─── METRICAS ─── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

@media (max-width: 600px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.value {
  font-size: 1.8rem;
  font-family: monospace;
  color: var(--text);
  line-height: 1;
}

.value.green { color: var(--green); }
.value.small { font-size: 0.85rem; }

/* ─── SECTION ─── */
.section {
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem 0;
}

.section h2 {
  color: var(--green);
  font-size: 0.95rem;
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

/* ─── MERCADO ─── */
.market-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 600px) {
  .market-grid { grid-template-columns: 1fr; }
}

.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}

.coin-name {
  font-family: monospace;
  font-weight: bold;
  color: var(--green);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
  letter-spacing: 0.05em;
}

.rate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem 0;
}

.rate-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.rate-val {
  font-family: monospace;
  font-size: 1rem;
  color: var(--text);
}

.rate-val.green { color: var(--green); }

/* ─── CONTROLES ─── */
.controls .control-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.controls label {
  color: var(--text-muted);
  font-size: 0.9rem;
  min-width: 180px;
}

.controls input[type="range"] {
  accent-color: var(--green);
  flex: 1;
  min-width: 120px;
}

.controls input[type="checkbox"] {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
}

.pause-btn {
  border: 1px solid var(--green);
  color: var(--green);
  background: transparent;
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.pause-btn:hover { background: rgba(0,255,136,0.08); }
.pause-btn.paused { border-color: var(--red); color: var(--red); }
.pause-btn.paused:hover { background: rgba(255,68,68,0.08); }

.save-btn {
  background: var(--green);
  color: #000;
  font-weight: bold;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  transition: opacity 0.2s;
}

.save-btn:hover { opacity: 0.85; }

#save-msg {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* ─── TABLA ─── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-family: monospace;
  font-size: 13px;
  white-space: nowrap;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,255,136,0.03); }

.green { color: var(--green); }
.status-applied { color: var(--green); }
.status-completed { color: var(--green2); }
.status-cancelled { color: var(--red); }

/* ─── FOOTER ─── */
footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 2rem 0 1rem;
}
