/* ============ Login page ============ */
.login-body {
  background: linear-gradient(135deg, #110A2E 0%, #1A1240 100%);
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.login-wrap { width: 100%; padding: 20px; display: flex; justify-content: center; }
.login-card {
  background: white; border-radius: 16px; padding: 40px 32px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(109,40,217,0.2);
  text-align: center; color: #1f2937;
}
.login-card h1 {
  margin: 8px 0 4px; color: #110A2E; font-size: 22px;
  letter-spacing: -0.02em; font-weight: 700;
}
.login-card .muted { color: #6B6995; font-size: 13px; margin: 0 0 24px; }
.logo-row { display: flex; justify-content: center; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 12px 16px;
  background: white; border: 1px solid #DADCE0; border-radius: 10px;
  color: #3C4043; font-weight: 500; font-size: 14px;
  text-decoration: none; cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s;
}
.btn-google:hover { background: #F8F9FA; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.login-footer {
  margin-top: 24px; font-size: 11px; color: #9D9DBA;
  padding-top: 16px; border-top: 1px solid #E0E5F2;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0e1419;
  color: #e4e7eb;
  padding: 0;
}
header {
  background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 100%);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #2e3a48;
}
header h1 { margin: 0; font-size: 18px; font-weight: 700; }
.status-row { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.header-sep { color: #475569; font-size: 16px; opacity: 0.5; }
#logout-google { background: #fef2f2; color: #b91c1c; border-color: #fecaca; text-decoration: none; }
#logout-google:hover { background: #fee2e2; }

/* Banner · service pausado */
.banner {
  background: rgba(220, 38, 38, 0.18);
  border-top: 2px solid #b91c1c;
  border-bottom: 2px solid #b91c1c;
  color: #fecaca;
  padding: 10px 28px;
  font-size: 13px;
  text-align: center;
}
.banner.hidden { display: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #6b7280; }
.dot.on { background: #10b981; box-shadow: 0 0 6px #10b981; }
.dot.off { background: #6b7280; }
.muted { color: #94a3b8; font-size: 13px; }
.small { font-size: 11px; }

.view { padding: 24px; max-width: 1100px; margin: 0 auto; }
.view.view-centered { max-width: 480px; padding-top: 60px; }
.view.hidden { display: none; }
.view h2 { margin: 0 0 8px; color: #d8b4fe; }

/* ============ APP SHELL with sidebar ============ */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: calc(100vh - 52px);  /* minus header */
}
.app-shell.hidden { display: none; }

.sidebar {
  background: #0a0e13;
  border-right: 1px solid #2e3a48;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  position: relative;
  transition: background 100ms;
}
.nav-link:hover { background: #1a2230; }
.nav-link.active {
  background: rgba(109, 40, 217, 0.20);
  color: #d8b4fe;
  font-weight: 600;
}
.nav-icon { font-size: 16px; width: 22px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: #1e293b;
  color: #cbd5e1;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}
.nav-badge.red { background: #7f1d1d; color: #fecaca; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 18px;
  border-top: 1px solid #2e3a48;
}

.content {
  overflow-y: auto;
  padding: 22px 32px;
  height: calc(100vh - 52px);
}
.subview { display: block; }
.subview.hidden { display: none; }
.subview h2 {
  margin: 0 0 14px;
  color: #d8b4fe;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.subview h2 .badge { font-size: 12px; }

/* Big list · scroll vertical en su área */
.big-list {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 800px) {
  .app-shell { grid-template-columns: 60px 1fr; }
  .nav-link span:not(.nav-icon):not(.nav-badge) { display: none; }
}

.card {
  background: #1a2230;
  padding: 18px;
  border-radius: 10px;
  margin-bottom: 14px;
  border: 1px solid #2e3a48;
}
.card h3 { margin: 0 0 12px; font-size: 14px; color: #cbd5e1; display: flex; justify-content: space-between; align-items: center; }
label { display: block; font-size: 12px; color: #94a3b8; margin-bottom: 10px; }
label input {
  display: block; width: 100%; padding: 8px 10px; margin-top: 4px;
  background: #0e1419; color: #e4e7eb; border: 1px solid #2e3a48; border-radius: 6px;
  font-size: 14px;
}
label input:focus { outline: none; border-color: #8b5cf6; }
button {
  background: #1e293b; color: #e4e7eb; border: 1px solid #2e3a48;
  padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px;
  transition: background 120ms;
}
button:hover { background: #2e3a48; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: #6d28d9; border-color: #6d28d9; color: white; font-weight: 600; }
.btn-primary:hover { background: #7c3aed; }
.btn-tiny { padding: 4px 8px; font-size: 11px; }
.btn-tiny.right { float: right; }
.btn-danger { background: #b91c1c; border-color: #b91c1c; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #047857; border-color: #047857; color: white; }
.btn-success:hover { background: #10b981; }

.msg { margin-top: 10px; padding: 8px 10px; border-radius: 6px; font-size: 13px; min-height: 18px; }
.msg.err { background: rgba(220, 38, 38, 0.15); color: #fca5a5; border-left: 3px solid #b91c1c; }
.msg.ok  { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border-left: 3px solid #047857; }
.msg.busy { background: rgba(99, 102, 241, 0.15); color: #c7d2fe; border-left: 3px solid #6366f1; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 14px; }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card.mini { padding: 12px 14px; }
.card.mini h3 { font-size: 12px; margin-bottom: 8px; }
.stats-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats-mini > div { display: flex; flex-direction: column; gap: 2px; }
.stats-mini strong { color: #d8b4fe; font-size: 16px; }
.stats-mini strong.red { color: #fca5a5; }

.row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
hr { border: none; border-top: 1px solid #2e3a48; margin: 12px 0; }

.badge {
  background: #4c1d95; color: #d8b4fe; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700;
}

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0; background: #6b7280;
  border-radius: 22px; transition: 0.2s;
}
.slider::before {
  position: absolute; content: ""; height: 16px; width: 16px;
  left: 3px; top: 3px; background: white; border-radius: 50%; transition: 0.2s;
}
input:checked + .slider { background: #10b981; }
input:checked + .slider::before { transform: translateX(18px); }

/* Balance list */
.balance-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #2e3a48;
}
.balance-row:last-child { border-bottom: none; }
.balance-type { font-size: 11px; color: #94a3b8; letter-spacing: 0.1em; }
.balance-amount { font-size: 16px; font-weight: 700; color: #10b981; }

/* Queue items */
.queue-item {
  background: #0e1419; padding: 10px 12px; border-radius: 6px;
  border-left: 3px solid #6d28d9; margin-bottom: 8px;
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
}
.queue-item.processing { border-left-color: #fbbf24; }
.queue-item.done { border-left-color: #10b981; opacity: 0.6; }
.queue-item.failed { border-left-color: #ef4444; }
.queue-item.rejected { border-left-color: #94a3b8; opacity: 0.5; }
.qi-info { font-size: 13px; }
.qi-name { font-weight: 600; color: #e4e7eb; }
.qi-meta { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.qi-amount { font-size: 15px; font-weight: 700; color: #fbbf24; text-align: right; min-width: 110px; }
.qi-actions { grid-column: 1 / -1; display: flex; gap: 6px; margin-top: 6px; }
.queue-item.rule-blocked { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.05); }
.qi-blocked {
  margin-top: 4px;
  font-size: 11px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.10);
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 2px solid #f59e0b;
}
.btn-disabled {
  background: #374151;
  color: #6b7280;
  border-color: #4b5563;
  cursor: not-allowed;
}
.btn-disabled:hover { background: #374151; }

/* Stats bar */
.stats-card { display: flex; gap: 30px; justify-content: space-around; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-label { font-size: 10px; color: #94a3b8; letter-spacing: 0.1em; text-transform: uppercase; }
.stat-val { font-size: 22px; font-weight: 700; color: #d8b4fe; }
.stat-val.red { color: #fca5a5; }

.badge.red { background: #7f1d1d; color: #fecaca; }

.filter-select {
  background: #0e1419; color: #e4e7eb; border: 1px solid #2e3a48;
  padding: 3px 8px; border-radius: 4px; font-size: 11px; margin-left: 8px;
}

/* Attention items · crítico · roja */
.attn-item {
  background: rgba(220, 38, 38, 0.08);
  border-left: 4px solid #b91c1c;
  padding: 10px 12px; border-radius: 6px; margin-bottom: 8px;
}
.attn-kind { font-size: 11px; color: #fca5a5; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.attn-desc { margin: 4px 0; }
.attn-meta { font-size: 11px; color: #94a3b8; }
.attn-actions { margin-top: 6px; }

/* Sent dispersion items */
.sent-item {
  background: #0e1419; padding: 8px 12px; border-radius: 6px;
  border-left: 3px solid #4c1d95; margin-bottom: 6px;
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  font-size: 12px;
}
.sent-item.approved { border-left-color: #10b981; }
.sent-item.rejected { border-left-color: #ef4444; }
.sent-item.created { border-left-color: #fbbf24; }
.sent-name { font-weight: 600; color: #e4e7eb; }
.sent-meta { font-size: 11px; color: #94a3b8; }
.sent-amount { font-size: 14px; font-weight: 700; }
.state-pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.state-pill.approved { background: rgba(16,185,129,0.18); color: #6ee7b7; }
.state-pill.rejected { background: rgba(239,68,68,0.18); color: #fca5a5; }
.state-pill.created  { background: rgba(251,191,36,0.18); color: #fde68a; }
.state-pill.unknown  { background: #2e3a48; color: #cbd5e1; }

/* Trueno items · grid más completo */
.trueno-item {
  background: #0e1419; padding: 8px 12px; border-radius: 6px;
  margin-bottom: 6px;
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  font-size: 12px;
  border-left: 3px solid #6b7280;
}
.trueno-item.approved { border-left-color: #10b981; }
.trueno-item.rejected { border-left-color: #ef4444; }
.trueno-item.created  { border-left-color: #fbbf24; }
.trueno-item.fee      { border-left-color: #4c1d95; opacity: 0.55; font-size: 11px; }
.trueno-desc { font-size: 11px; color: #c7d2fe; font-family: "SF Mono", monospace; }

/* Threshold table */
.threshold-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.threshold-table th, .threshold-table td {
  padding: 8px 10px; text-align: left; font-size: 12px;
  border-bottom: 1px solid #2e3a48;
}
.threshold-table th { color: #94a3b8; font-weight: 600; font-size: 11px; text-transform: uppercase; }
.threshold-table input[type="number"] {
  background: #0e1419; color: #e4e7eb; border: 1px solid #2e3a48;
  padding: 4px 8px; border-radius: 4px; width: 140px; font-size: 12px;
  font-family: monospace;
}
.threshold-table button {
  padding: 3px 8px; font-size: 11px;
}
.threshold-state { font-size: 11px; }
.threshold-state.ok    { color: #6ee7b7; }
.threshold-state.alert { color: #fca5a5; }

/* Event log */
#event-log {
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 11px;
  max-height: 240px; overflow-y: auto; line-height: 1.5;
}
.log-line { padding: 2px 0; border-bottom: 1px dotted #2e3a48; }
.log-ts { color: #6366f1; }
.log-kind { color: #fbbf24; padding: 0 6px; }
.log-payload { color: #94a3b8; }
