/* ANTIVITALIK Dashboard — Dark Theme */

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

:root {
  --bg: #0f0f0f;
  --card: #1a1a1a;
  --card-border: #2d2d2d;
  --accent: #f97316;
  --accent-hover: #ea6c0a;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --green: #22c55e;
  --yellow: #eab308;
  --orange: #f97316;
  --red: #ef4444;
  --dark-red: #991b1b;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Typography ─────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; color: var(--text); }
h3 { font-size: 1rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.5rem; }

/* ── Layout ─────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Nav ─────────────────────────────────────────── */
nav {
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.nav-brand span { color: var(--text); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-user { color: var(--text-muted); font-size: 0.875rem; }

/* ── Card ─────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 7px;
  border: none;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

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

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-danger { background: #7f1d1d; color: #fca5a5; }
.btn-danger:hover:not(:disabled) { background: #991b1b; }
.btn-warning { background: #78350f; color: #fcd34d; }
.btn-warning:hover:not(:disabled) { background: #92400e; }

.btn-success { background: #14532d; color: #86efac; }
.btn-success:hover:not(:disabled) { background: #166534; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
}
.btn-ghost:hover:not(:disabled) { background: var(--card-border); color: var(--text); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* ── Status indicator ────────────────────────────── */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-red { background: var(--red); }
.dot-gray { background: #4b5563; }

.status-text-running { color: var(--green); font-weight: 600; }
.status-text-stopped { color: var(--red); font-weight: 600; }

/* ── PnL colors ──────────────────────────────────── */
.pnl-green { color: var(--green); }
.pnl-yellow { color: var(--yellow); }
.pnl-orange { color: var(--orange); }
.pnl-red { color: var(--red); }
.pnl-terminal {
  color: #fca5a5;
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Grid ─────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

/* ── Position card ───────────────────────────────── */
.position-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1.25rem;
}

.position-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.position-symbol {
  font-size: 1.1rem;
  font-weight: 700;
}

.position-status {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-weight: 600;
}

.status-open { background: #14532d; color: #86efac; }
.status-closed { background: #1f2937; color: #6b7280; }

.position-pnl {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.position-pnl-usdt {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.position-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid #1e1e1e;
}

.position-row:last-child { border-bottom: none; }
.position-row .label { color: var(--text-muted); }
.position-row .value { font-weight: 500; }

/* ── Progress bar ────────────────────────────────── */
.progress-wrap { margin-top: 0.75rem; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.progress-bar {
  background: #2d2d2d;
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* ── Recharge form ───────────────────────────────── */
.recharge-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 120px;
}

.form-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

select, input[type="number"], input[type="text"], input[type="password"] {
  background: #0f0f0f;
  border: 1px solid var(--card-border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

select:focus, input:focus {
  border-color: var(--accent);
}

.balas-remaining {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #1e1e1e;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #1e1e1e; }

/* ── Log viewer ──────────────────────────────────── */
.log-viewer {
  background: #0a0a0a;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-line { display: block; padding: 1px 0; }
.log-info { color: #64748b; }
.log-warning { color: var(--yellow); }
.log-error { color: var(--red); }
.log-debug { color: #4b5563; }

/* ── Login page ──────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  font-size: 1.5rem;
  color: var(--accent);
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.3rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form .form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.login-form .btn {
  width: 100%;
  justify-content: center;
  padding: 0.65rem;
}

.login-error {
  color: #fca5a5;
  background: #450a0a;
  border: 1px solid #7f1d1d;
  border-radius: 7px;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  display: none;
}

.login-error.visible { display: block; }

/* ── Modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.75rem;
  width: 100%;
  max-width: 480px;
}

.modal h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.modal-message {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  justify-content: flex-end;
}

/* ── Utility ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green { background: #14532d; color: #86efac; }
.badge-red { background: #450a0a; color: #fca5a5; }
.badge-gray { background: #1f2937; color: #9ca3af; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.info-item {
  background: #111;
  border-radius: 8px;
  padding: 0.75rem;
}

.info-item .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.info-item .value {
  font-size: 1.1rem;
  font-weight: 600;
}

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.flex { display: flex; }
.gap-2 { gap: 0.5rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.main-content {
  padding: 1.5rem 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Toast ───────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
}

.toast {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  max-width: 320px;
  animation: slideIn 0.2s ease;
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.credentials-masked {
  font-family: monospace;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: #111;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--card-border);
  word-break: break-all;
}

/* ── HMM Layout ─────────────────────────────────────────────────────────── */
.hmm-layout {
  display: flex;
  min-height: calc(100vh - 110px);
  gap: 0;
}

/* Sidebar */
.hmm-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #111;
  border-right: 1px solid var(--card-border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hmm-sidebar-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.hmm-field {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.hmm-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.hmm-hint {
  font-size: 0.7rem;
  color: #555;
}

.hmm-run-btn {
  width: 100%;
  margin-top: 0.5rem;
}

/* BIC score list */
.hmm-bic-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  padding: 0.2rem 0;
  color: var(--text-muted);
}

.hmm-bic-row.best {
  color: var(--accent);
  font-weight: 700;
}

/* Main area */
.hmm-main {
  flex: 1;
  padding: 1.25rem 1.5rem;
  overflow-x: hidden;
}

/* Status bar */
.hmm-status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #4caf50;
  background: #0a1f0a;
  border: 1px solid #2e7d32;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  margin-bottom: 1rem;
}

/* Title row */
.hmm-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.hmm-title-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
}

.hmm-title-bar {
  width: 6px;
  border-radius: 2px;
}

.hmm-title-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Loading */
.hmm-loading-box {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.hmm-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: hmm-spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes hmm-spin { to { transform: rotate(360deg); } }

/* Error */
.hmm-error-box {
  padding: 1rem;
  background: #1a0000;
  border: 1px solid #cc2222;
  border-radius: 8px;
  color: #ff6b6b;
}

/* Cards row */
.hmm-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.hmm-card {
  background: #111;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  transition: border-color 0.3s;
}

.hmm-card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.hmm-card-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hmm-meta-lines {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.hmm-meta-lines strong {
  color: var(--text);
}

/* Mini prob cards */
.hmm-prob-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.hmm-prob-card {
  flex: 1;
  min-width: 90px;
  background: #111;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  text-align: center;
  cursor: default;
  transition: border-color 0.2s, background 0.2s;
}

.hmm-prob-card.active {
  border-width: 2px;
  background: #181818;
}

.hmm-prob-pct {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.hmm-prob-name {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Tab navigation ─────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 0;
  padding: 0 1.5rem;
  background: #111;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 56px;
  z-index: 90;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

/* ── HMM form select ─────────────────────────────────────────────────────── */
.form-select {
  background: #111;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.45rem 0.75rem;
  width: 100%;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── HMM probability bars ────────────────────────────────────────────────── */
.hmm-prob-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}

.hmm-prob-bar-bg {
  flex: 1;
  height: 6px;
  background: #2d2d2d;
  border-radius: 3px;
  overflow: hidden;
}

.hmm-prob-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.hmm-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hmm-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .nav-inner { flex-wrap: wrap; gap: 0.5rem; }
  .form-row { flex-direction: column; }
  h1 { font-size: 1.4rem; }
  .tab-nav { padding: 0 0.5rem; top: 0; }
}

/* ── HMM Gate Section ──────────────────────────────────────────────────────── */

.gate-card {
  background: #111;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.gate-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.gate-badge {
  margin-left: auto;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.gate-badge-neutral  { background: #2d2d2d; color: #94a3b8; }
.gate-badge-open     { background: #14532d; color: #4ade80; }
.gate-badge-blocked  { background: #450a0a; color: #f87171; }
.gate-badge-pending  { background: #451a03; color: #fbbf24; }

.gate-regime-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gate-regime-pill {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: #6b7280;
}

.gate-status-msg {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.gate-pending-block {
  background: #1c1200;
  border: 1px solid #78350f;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}
.gate-pending-label  { font-size: 0.75rem; font-weight: 700; color: #fbbf24; margin-bottom: 0.2rem; }
.gate-pending-detail { font-size: 0.78rem; color: #fde68a; line-height: 1.4; }

.gate-actions { display: flex; gap: 0.5rem; }

.btn-warning {
  background: #92400e;
  color: #fde68a;
  border: none;
}
.btn-warning:hover { background: #b45309; }

.gate-schedule-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding-top: 0.4rem;
  border-top: 1px solid var(--card-border);
  margin-top: 0.2rem;
}

.gate-schedule-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.gate-schedule-label input[type=checkbox] { cursor: pointer; accent-color: var(--accent); }

.gate-time-input {
  background: #1e1e1e;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
  font-family: var(--font);
  width: 7rem;
}
.gate-time-input:disabled { opacity: 0.4; }

.text-xs { font-size: 0.72rem; }

/* ══ Tab Estrategia ══════════════════════════════════════════════════════ */

.strat-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.strat-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--card-border);
}

.strat-header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.strat-header .accent { color: var(--accent); }

.strat-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.strat-section {
  margin-bottom: 2.5rem;
}

.strat-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--card-border);
}

.strat-sub-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.strat-text {
  color: var(--text-muted);
  font-size: 0.93rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.strat-text strong { color: var(--text); }
.strat-text em { color: var(--accent); font-style: normal; }

/* Grids */
.strat-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.strat-grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 1rem; }

@media (max-width: 700px) {
  .strat-grid-3, .strat-grid-2 { grid-template-columns: 1fr; }
}

/* Cards de stats */
.strat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.strat-card-icon {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 0.25rem;
}

.strat-card-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.strat-card-value { font-size: 1.1rem; font-weight: 700; }
.strat-card-sub   { font-size: 0.78rem; color: var(--text-muted); }

.strat-card-red    { border-color: #7f1d1d; }
.strat-card-red .strat-card-icon,
.strat-card-red .strat-card-value { color: #ef4444; }

.strat-card-orange { border-color: #7c2d12; }
.strat-card-orange .strat-card-icon,
.strat-card-orange .strat-card-value { color: var(--accent); }

.strat-card-blue   { border-color: #1e3a5f; }
.strat-card-blue .strat-card-icon,
.strat-card-blue .strat-card-value { color: #60a5fa; }

.strat-card-green  { border-color: #14532d; }
.strat-card-green .strat-card-icon,
.strat-card-green .strat-card-value { color: #22c55e; }

/* Tabla de recargas */
.strat-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--card-border);
}

.strat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.strat-table th {
  background: #1e1e1e;
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
}

.strat-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #1e1e1e;
  vertical-align: middle;
}

.strat-table tbody tr:last-child td { border-bottom: none; }
.strat-table tbody tr:hover { background: #1e1e1e; }

.row-green      td:first-child { color: #4ade80; }
.row-green-light td:first-child { color: #86efac; }
.row-neutral    td:first-child { color: var(--text-muted); }
.row-yellow     td:first-child { color: #fbbf24; }
.row-orange     td:first-child { color: #fb923c; }
.row-orange-dark td:first-child { color: #ef4444; }
.row-red        td:first-child { color: #f87171; font-weight: 700; }

/* Visualizador de balas */
.strat-bullets-visual {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.strat-bullet-legend {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.bullet-dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
}
.bullet-pos  { background: var(--accent); }
.bullet-mar  { background: #60a5fa; }
.bullet-free { background: #2d2d2d; border: 1px solid #444; }

.strat-bullet-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.strat-bullet {
  width: 22px; height: 22px;
  border-radius: 50%;
  transition: transform 0.15s;
}
.strat-bullet:hover { transform: scale(1.3); }
.strat-bullet.pos  { background: var(--accent); }
.strat-bullet.mar  { background: #60a5fa; }
.strat-bullet.free { background: #2d2d2d; border: 1px solid #3d3d3d; }

/* HMM Flow */
.strat-hmm-flow {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.hmm-flow-step {
  flex: 1;
  min-width: 150px;
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border: 1px solid var(--card-border);
}

.hmm-flow-arrow {
  display: flex;
  align-items: center;
  font-size: 1.4rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
}

.hmm-step-block    { background: #1c0a0a; border-color: #7f1d1d; }
.hmm-step-watch    { background: #1a1a0a; border-color: #78350f; }
.hmm-step-fire     { background: #0a1c0a; border-color: #14532d; }
.hmm-step-deadline { background: #0a0a1c; border-color: #1e3a5f; }

.hmm-flow-icon  { font-size: 1.4rem; }
.hmm-flow-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.hmm-flow-desc  { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.hmm-flow-desc strong { color: var(--text); }

/* Info blocks */
.strat-info-block {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.strat-info-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.strat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.strat-list li {
  font-size: 0.83rem;
  color: var(--text-muted);
  padding-left: 0.75rem;
  position: relative;
}

.strat-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.strat-list li strong { color: var(--text); }

/* Callouts */
.strat-callout {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

.strat-callout code {
  background: #2d2d2d;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.82em;
}

.strat-callout-info    { background: #0f1f2e; border: 1px solid #1e3a5f; color: #93c5fd; }
.strat-callout-warning { background: #1c110a; border: 1px solid #7c2d12; color: #fdba74; }

/* Flujo diario */
.strat-flow-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.strat-flow-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  line-height: 1.6;
}

.strat-flow-list li strong { color: var(--text); }

.flow-num {
  background: var(--accent);
  color: #000;
  font-weight: 800;
  font-size: 0.75rem;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* ══ TP Config Panel ════════════════════════════════════════════════════ */

.tp-hold-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #1a1200;
  border: 1px solid #78350f;
  border-radius: 7px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  color: #fbbf24;
  margin-top: 0.5rem;
}

.tp-hold-icon { font-size: 1rem; }

.tp-config-panel {
  border-top: 1px solid var(--card-border);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
}

.tp-config-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.tp-config-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.tp-config-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 70px;
}

.tp-config-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.tp-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: #1e1e1e;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
}

.tp-input {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
  width: 100%;
  outline: none;
  -moz-appearance: textfield;
}
.tp-input::-webkit-outer-spin-button,
.tp-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.tp-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.tp-save-btn {
  background: #1e1e1e;
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.tp-save-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Version badge ──────────────────────────────────────────────────────── */
.nav-version {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: #1e1e1e;
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 0.15rem 0.5rem;
  font-family: monospace;
  letter-spacing: 0.03em;
}

.strat-version-footer {
  text-align: center;
  font-size: 0.78rem;
  color: #3d3d3d;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #1e1e1e;
}
