/* TESTEOS PRO - Estilos base */
:root {
  --bg: #F4F6F7;
  --bg-card: #ffffff;
  --bg-soft: #F3F4F6;
  --sidebar: #111827;
  --sidebar-active: #1f2937;
  --sidebar-text: #9ca3af;
  --text: #0F1419;
  --text-muted: #6B7280;
  --text-faint: #9CA3AF;
  --border: #E5E7EB;
  --border-strong: rgba(0,0,0,0.12);
  --accent: #1DD88B;
  --accent-dark: #0A6B43;
  --accent-text: #0F8F5B;
  --accent-soft: #D6F5E5;
  --accent-border: #A4E5C4;
  --warning: #F59E0B;
  --warning-soft: #fef3c7;
  --warning-dark: #92400e;
  --danger: #EF4444;
  --danger-soft: #fef2f2;
  --info: #3B82F6;
  --purple: #8B5CF6;
  --radius-md: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
/* ─── Typography ─────────────────────────────── */
.card-name, .col-pill, .kpi-value, .login-title,
.sidebar-brand, .brand-pro, .compras-card-name,
.detail-name, .dtab-btn, h1, h2, h3 {
  font-family: "Montserrat", sans-serif;
}

  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ─── Login ───────────────────────────────── */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 100;
}
.login-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 320px;
  display: flex; flex-direction: column; gap: 12px;
}
.login-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 500; color: var(--text);
}
.login-pro {
  font-size: 10px; background: var(--accent); color: #052e2b;
  padding: 2px 6px; border-radius: 4px; font-weight: 600; letter-spacing: 0.5px;
}
.login-subtitle { color: var(--text-muted); margin: 0 0 8px; font-size: 13px; }
.login-card input {
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.login-card input:focus { box-shadow: 0 0 0 2px var(--accent-soft); border-color: var(--accent); }
.login-card button {
  background: var(--accent); color: white;
  border: 0; border-radius: var(--radius-md);
  padding: 10px; font-size: 14px; font-weight: 500;
  cursor: pointer; margin-top: 4px;
}
.login-error {
  color: var(--danger); font-size: 12px; margin: 4px 0 0;
}

/* ─── Layout ──────────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 200px;
  background: var(--sidebar);
  padding: 18px 0;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 4px;
  transition: width 0.2s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 52px; }

.sidebar-brand {
  padding: 0 18px 22px;
  display: flex; align-items: center; justify-content: space-between;
  color: white; font-size: 17px; font-weight: 500; letter-spacing: -0.3px;
}
.sidebar-brand-text { display: flex; align-items: center; gap: 8px; }
.sidebar.collapsed .sidebar-brand-text { display: none; }

.sidebar-toggle {
  background: transparent; border: 0;
  color: var(--sidebar-text); cursor: pointer;
  padding: 2px 4px; border-radius: 4px; line-height: 1;
  font-size: 20px; flex-shrink: 0; letter-spacing: 0;
}
.sidebar-toggle:hover { color: white; }

.brand-pro {
  font-size: 9px; background: var(--accent); color: #052e2b;
  padding: 2px 6px; border-radius: 4px; font-weight: 600; letter-spacing: 0.5px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-md);
  color: var(--sidebar-text); font-size: 13px;
  text-decoration: none; white-space: nowrap;
}
.nav-item.active { background: var(--sidebar-active); color: var(--accent); font-weight: 500; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px; }
.sidebar.collapsed .nav-item span { display: none; }

.sidebar-foot {
  margin-top: auto;
  padding: 14px 10px;
  border-top: 0.5px solid var(--sidebar-active);
  display: flex; flex-direction: column; gap: 8px;
  align-items: stretch;
}
.logout {
  background: transparent; border: 0.5px solid var(--sidebar-active);
  color: var(--sidebar-text); padding: 6px 10px;
  border-radius: var(--radius-md); font-size: 12px;
  cursor: pointer; white-space: nowrap; overflow: hidden;
}
.logout:hover { background: var(--sidebar-active); }
.sidebar.collapsed .logout { font-size: 0; padding: 6px; text-align: center; }
.sidebar.collapsed .logout::after { content: "→"; font-size: 13px; }

.main {
  flex: 1;
  padding: 22px 24px 36px;
  overflow-x: auto;
}

/* ─── Topbar ──────────────────────────────── */
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px;
}
.topbar h1 { font-size: 22px; font-weight: 500; margin: 0; letter-spacing: -0.3px; }
.subtitle { color: var(--text-muted); margin: 2px 0 0; font-size: 12px; }
.actions { display: flex; gap: 8px; }
.btn-secondary, .btn-primary {
  border-radius: var(--radius-md);
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  border: 0.5px solid var(--border-strong);
  background: white;
  color: var(--text);
}
.btn-primary {
  background: var(--accent);
  color: white;
  border: 0;
  font-weight: 500;
}

/* ─── KPI cards ───────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.kpi-card {
  background: white;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.kpi-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.kpi-icon {
  width: 28px; height: 28px; border-radius: var(--radius-md);
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon.warn { background: var(--warning-soft); }
.kpi-label {
  font-size: 10px; font-weight: 500; color: var(--text-muted);
  letter-spacing: 1px;
}
.kpi-value { font-size: 26px; font-weight: 500; letter-spacing: -0.5px; }
.kpi-foot { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.kpi-foot.up { color: var(--accent); }
.kpi-foot.warn { color: var(--warning); }

/* ─── Kanban ──────────────────────────────── */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  overflow-x: auto;
}
.column { display: flex; flex-direction: column; }
.column-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; padding: 0 4px;
}
.column-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: #374151;
}
.column-dot { width: 8px; height: 8px; border-radius: 50%; }
.col-pill {
  font-size: 11px; color: var(--accent-text);
  background: var(--accent-soft); padding: 2px 8px;
  border-radius: 100px; font-weight: 600;
}
.col-zero { font-size: 11px; color: var(--text-faint); font-weight: 500; }
.column-body {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 80px; padding: 4px 0;
  border-radius: var(--radius-md);
  transition: background 0.15s;
}
.column-body.column-empty {
  min-height: 240px;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
}
.column-body.drag-over { background: rgba(29,216,139,0.06); outline: 1.5px dashed var(--accent); }

/* ─── Cards ───────────────────────────────── */
.card {
  background: white;
  border: 0.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.card.dragging { opacity: 0.4; }

.card-header {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 12px 8px;
}
.card-thumb {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--bg-soft); background-size: cover; background-position: center;
  flex-shrink: 0;
}
.card-thumb-emoji {
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.card-info { flex: 1; min-width: 0; }
.card-name {
  font-size: 13px; font-weight: 600; color: #0F1419;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2;
}
.card-cat { font-size: 10px; color: #9CA3AF; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card-metrics {
  padding: 0 12px 10px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.metric-cell {
  background: #F3F4F6; border-radius: 6px; padding: 6px 8px; position: relative;
}
.metric-cell.metric-green { background: #D6F5E5; }
.metric-k {
  font-size: 9px; color: #6B7280; text-transform: uppercase;
  letter-spacing: 0.4px; margin-bottom: 2px; font-weight: 600;
}
.metric-cell.metric-green .metric-k { color: #0F8F5B; }
.metric-v { font-size: 14px; font-weight: 600; color: #0F1419; line-height: 1; }
.metric-cell.metric-green .metric-v { font-weight: 700; color: #0A6B43; }
.metric-v.metric-empty { color: #9CA3AF; }
.metric-unit { font-size: 10px; opacity: 0.7; }
.fire { position: absolute; top: 4px; right: 5px; font-size: 11px; }
.cpa-unit { font-size: 9px; color: #9CA3AF; font-weight: 500; }

.card-footer {
  padding: 8px 12px; background: #FAFBFC;
  border-top: 0.5px solid #F3F4F6;
  display: flex; justify-content: space-between; align-items: center;
}
.card-footer-status {
  display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden;
}
.footer-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.footer-text { font-size: 10px; color: #6B7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-advance-btn {
  font-size: 12px; padding: 4px 10px;
  background: var(--accent-soft); color: var(--accent-dark);
  border: 0.5px solid var(--accent-border); border-radius: 5px;
  cursor: pointer; font-weight: 600; flex-shrink: 0;
}
.card-advance-btn:hover { background: var(--accent-border); }
.card-advance-done { background: var(--accent-soft); color: var(--accent-dark); }

/* ─── Compras view ────────────────────────── */
.compras { width: 100%; }
.compras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.compras-card {
  background: white; border: 0.5px solid var(--border);
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 0.15s;
}
.compras-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.compras-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 300px; text-align: center; color: var(--text-muted);
}
.kpi-unit { font-size: 14px; color: #9CA3AF; }

/* ─── Modal ───────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(17,24,39,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  width: 440px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 500; }
.modal-close {
  background: transparent; border: 0;
  font-size: 24px; line-height: 1; cursor: pointer; color: var(--text-muted);
}
.modal-body {
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-body label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--text-muted);
}
.modal-body input,
.modal-body select,
.modal-body textarea {
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  color: var(--text);
}
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  box-shadow: 0 0 0 2px var(--accent-soft); border-color: var(--accent);
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 8px;
}

/* ─── Responsive ──────────────────────────── */
@media (max-width: 1280px) {
  .kanban { grid-template-columns: repeat(5, minmax(200px, 1fr)); }
}
@media (max-width: 768px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kanban { grid-template-columns: repeat(5, minmax(200px, 1fr)); overflow-x: auto; }
  .sidebar { width: 60px; }
  .sidebar-brand-text { display: none; }
  .nav-item { justify-content: center; padding: 9px; }
  .nav-item span { display: none; }
}

/* ─── Detail Panel ────────────────────────── */
.detail-overlay {
  position: fixed; inset: 0;
  background: rgba(17,24,39,0.4);
  z-index: 60;
}
.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 520px; max-width: 96vw;
  background: white;
  z-index: 61;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  transform: translateX(0);
  transition: transform 0.22s ease;
}
.detail-panel.hidden { display: none; }

.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
}
.detail-header-left { display: flex; align-items: center; gap: 12px; }
.detail-thumb {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--bg-soft); background-size: cover; background-position: center;
  flex-shrink: 0;
}
.detail-name { font-size: 15px; font-weight: 500; }
.detail-stage-badge {
  display: inline-block; margin-top: 3px;
  font-size: 10px; padding: 2px 8px;
  border-radius: 4px; font-weight: 600; letter-spacing: 0.3px;
}
.detail-close {
  background: transparent; border: 0;
  font-size: 26px; line-height: 1; cursor: pointer;
  color: var(--text-muted); padding: 4px 8px;
}

.detail-tabs {
  display: flex; gap: 0;
  border-bottom: 0.5px solid var(--border);
  padding: 0 12px;
  flex-shrink: 0;
  overflow-x: auto;
}
.dtab {
  background: transparent; border: 0;
  padding: 10px 12px;
  font-size: 12px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.dtab.active { color: var(--accent); border-bottom-color: var(--accent); }

.detail-body {
  flex: 1; overflow-y: auto;
  padding: 20px;
}
.dtab-content { display: flex; flex-direction: column; gap: 16px; }
.dtab-content.hidden { display: none; }

/* ─── Sub-forms ───────────────────────────── */
.sub-form {
  display: flex; flex-direction: column; gap: 10px;
}
.sub-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--text-muted);
}
.label-check {
  flex-direction: row !important; align-items: center; gap: 8px !important;
  font-size: 13px !important; color: var(--text) !important; cursor: pointer;
}
.sub-form input,
.sub-form select,
.sub-form textarea {
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  color: var(--text);
  background: white;
}
.sub-form input:focus,
.sub-form select:focus,
.sub-form textarea:focus {
  box-shadow: 0 0 0 2px var(--accent-soft); border-color: var(--accent);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sub-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.sub-form-wrap { border-top: 0.5px solid var(--border); padding-top: 16px; margin-top: 4px; }
.sub-form-title { font-size: 13px; font-weight: 500; margin-bottom: 12px; color: var(--text); }
.btn-add { margin-bottom: 4px; }

/* ─── Stage section ───────────────────────── */
.stage-section {
  border-top: 0.5px solid var(--border);
  padding-top: 16px;
}
.stage-section-title { font-size: 11px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.8px; margin-bottom: 10px; }
.stage-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.stage-btn {
  padding: 5px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  border: 1.5px solid transparent;
}
.stage-reason-wrap {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--text-muted);
}
.stage-reason-wrap input {
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-md); padding: 7px 10px;
  font-size: 13px; outline: none;
}
.stage-reason-wrap input:focus { box-shadow: 0 0 0 2px var(--accent-soft); border-color: var(--accent); }

/* ─── Danger section ──────────────────────── */
.danger-section { border-top: 0.5px solid var(--border); padding-top: 16px; }
.btn-danger {
  background: transparent; border: 0.5px solid #fca5a5;
  color: var(--danger); padding: 7px 14px;
  border-radius: var(--radius-md); font-size: 13px; cursor: pointer;
}
.btn-danger:hover { background: var(--danger-soft); }

/* ─── Sub-resource lists ──────────────────── */
.sub-list { display: flex; flex-direction: column; gap: 8px; }
.sub-item {
  background: var(--bg-soft); border-radius: var(--radius-md);
  padding: 10px 12px;
}
.sub-item-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
.sub-item-title { font-size: 13px; font-weight: 500; }
.sub-item-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.sub-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-icon {
  background: transparent; border: 0.5px solid var(--border-strong);
  border-radius: 6px; padding: 3px 8px; font-size: 11px; cursor: pointer;
  color: var(--text-muted);
}
.btn-icon:hover { background: white; color: var(--text); }
.btn-icon.del:hover { background: var(--danger-soft); border-color: #fca5a5; color: var(--danger); }

.verdict-badge {
  display: inline-block; font-size: 10px; padding: 2px 7px;
  border-radius: 4px; font-weight: 600;
}
.verdict-winner { background: var(--accent-soft); color: var(--accent-dark); }
.verdict-loser { background: var(--danger-soft); color: var(--danger); }
.verdict-inconclusive { background: var(--warning-soft); color: var(--warning-dark); }
.verdict-in_progress { background: var(--bg-soft); color: var(--text-muted); }

/* ─── History list ────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 0; }
.history-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
}
.history-item:last-child { border-bottom: 0; }
.history-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-top: 5px; flex-shrink: 0;
}
.history-text { font-size: 12px; }
.history-text strong { font-weight: 500; }
.history-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── Card clickable ──────────────────────── */
.card { cursor: pointer; }

/* ─── Auto-calculated inputs ─────────────── */
.input-auto {
  background: var(--bg-soft) !important;
  color: var(--text-muted) !important;
  cursor: default;
  font-weight: 500;
}
.verdict-pocas { background: #ede9fe; color: #6d28d9; }

/* ─── Lightbox ────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.lightbox-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 24px;
  animation: lb-in 0.18s ease;
}
@keyframes lb-in {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.lightbox-img {
  width: 260px; height: 260px;
  border-radius: 16px;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-size: 80px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.lightbox-name {
  font-size: 18px; font-weight: 600; color: white;
  text-align: center; max-width: 280px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.lightbox-cat {
  font-size: 12px; color: rgba(255,255,255,0.65);
  text-align: center;
}
.card-thumb-click { cursor: zoom-in; transition: transform 0.15s; }
.card-thumb-click:hover { transform: scale(1.08); }
