/* ============================================================================
   X-Mind — Cola de Revisión (mockup)
   Mismo design system del deck, pero layout de aplicación
   ============================================================================ */

html, body { overflow: auto; height: auto; }

.app-shell {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: var(--ink);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.brand-section {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-left: 1px solid var(--line);
  padding-left: 14px;
  margin-left: 4px;
}

.app-meta {
  display: flex;
  align-items: center;
  gap: 28px;
}
.meta-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.meta-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.meta-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--bg);
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body);
}
.user-name { font-size: 13px; font-weight: 500; }

/* ── Main grid: list + detail ────────────────────────────────────────────── */
.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  min-height: calc(100vh - 70px - 50px);
}

/* ── Case list (sidebar) ─────────────────────────────────────────────────── */
.case-list {
  background: var(--bg);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  max-height: calc(100vh - 70px - 50px);
}
.case-list-header {
  padding: 22px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 2;
}
.case-list-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s ease;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip-active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.case-list-body {
  padding: 8px 12px 22px;
}
.case-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 6px 0;
  cursor: pointer;
  transition: all .15s ease;
  position: relative;
}
.case-card:hover { border-color: var(--line-strong); transform: translateX(2px); }
.case-card.selected {
  border-color: var(--ink);
  background: var(--bg-elev);
  box-shadow: 0 4px 16px -8px rgba(0,0,0,0.08);
}
.case-card.selected::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  bottom: -1px;
  width: 3px;
  background: var(--accent);
  border-radius: 8px 0 0 8px;
}
.case-card .case-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.case-card .case-amount {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}
.case-card .case-channel {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 7px;
  border-radius: 4px;
}
.case-card .case-reason {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.case-card .case-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
}

/* ── Case detail ─────────────────────────────────────────────────────────── */
.case-detail {
  padding: 32px 40px 60px;
  overflow-y: auto;
  max-height: calc(100vh - 70px - 50px);
  background: var(--bg);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.detail-header .breadcrumb {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.detail-header h1 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}
.detail-header .case-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 6px;
}

.detail-section {
  margin-bottom: 32px;
}
.section-title {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Bank transaction card ──────────────────────────────────────────────── */
.bank-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px 28px;
}
.bank-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.bank-field .label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.bank-field .value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
}
.bank-field .value.empty {
  color: var(--ink-muted);
  font-style: italic;
}
.bank-field .value.amount {
  font-size: 24px;
  letter-spacing: -0.02em;
}
.bank-raw {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--bg);
  padding: 12px 14px;
  border-radius: 6px;
  margin-top: 18px;
}

/* ── Candidates ──────────────────────────────────────────────────────────── */
.candidates {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.candidate {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
  position: relative;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, box-shadow .2s ease;
}
.candidate:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.candidate.selected {
  border-color: var(--ink);
  box-shadow: 0 4px 22px -10px rgba(0,0,0,0.12);
}
.badge-top {
  position: absolute;
  top: -9px;
  left: 18px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  padding: 3px 9px;
  border-radius: 3px;
  pointer-events: none;
}

.candidate-info h3 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.candidate-info .sub {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
}
.candidate-info .reasoning {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.candidate-info .reasoning .hl {
  color: var(--ink);
  font-weight: 500;
}

.confidence {
  text-align: right;
  min-width: 110px;
}
.confidence .pct {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}
.confidence .pct.high { color: var(--good); }
.confidence .pct.mid { color: var(--warn); }
.confidence .pct.low { color: var(--bad); }
.confidence .lbl {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 4px;
}
.confidence .bar {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}
.confidence .bar-fill {
  height: 100%;
  background: var(--ink);
  border-radius: 2px;
}
.confidence .bar-fill.high { background: var(--good); }
.confidence .bar-fill.mid { background: var(--warn); }
.confidence .bar-fill.low { background: var(--bad); }

/* ── Actions ─────────────────────────────────────────────────────────────── */
.actions {
  display: flex;
  gap: 10px;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 28px;
}
.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn:hover { border-color: var(--ink); }
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--bg-elev); color: var(--ink); }
.btn .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(0,0,0,0.08);
  margin-left: 6px;
}
.btn-primary .kbd { background: rgba(255,255,255,0.18); }

/* ── Empty states ───────────────────────────────────────────────────────── */
.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-muted);
  font-size: 15px;
  padding: 80px 40px;
}
.empty-state .icon {
  width: 56px;
  height: 56px;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  margin-bottom: 18px;
}
.empty-list {
  padding: 32px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
}
.empty-done {
  text-align: center;
  padding: 80px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.empty-done .empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--good);
  margin-bottom: 24px;
  position: relative;
}
.empty-done .empty-icon::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -55%) rotate(45deg);
  width: 12px;
  height: 24px;
  border-right: 3px solid white;
  border-bottom: 3px solid white;
}
.empty-done h2 {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0 0 10px;
}
.empty-done .empty-sub {
  font-size: 16px;
  color: var(--ink-soft);
  margin-bottom: 32px;
  max-width: 36ch;
}
.empty-done .empty-stats {
  display: flex;
  gap: 56px;
  margin-bottom: 40px;
  padding: 24px 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
}
.empty-stat { display: flex; flex-direction: column; align-items: center; }
.empty-stat .num {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}
.empty-stat .lbl {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 8px;
}
.empty-done .reset-btn {
  font-size: 13px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 32px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--ink-muted);
  background: var(--bg);
  gap: 24px;
  flex-wrap: wrap;
}
.app-footer a { color: var(--ink); text-decoration: none; }
.app-footer a:hover { color: var(--accent); }
.dim { opacity: 0.6; margin: 0 6px; }

.footer-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}
.app-footer kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  margin: 0 2px;
}
.reset-mini {
  font-family: var(--font-body);
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink-soft);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
}
.reset-mini:hover { border-color: var(--ink); color: var(--ink); }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s cubic-bezier(.25,.46,.45,.94);
  z-index: 100;
  box-shadow: 0 12px 40px -10px rgba(0,0,0,0.3);
  max-width: 480px;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-good { background: var(--good); }
.toast-warn { background: var(--warn); }
.toast-muted { background: var(--ink-muted); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .bank-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 880px) {
  .app-main { grid-template-columns: 1fr; }
  .case-list { max-height: 280px; border-right: none; border-bottom: 1px solid var(--line); }
  .app-meta { gap: 14px; }
  .meta-item { display: none; }
  .meta-item:last-of-type { display: flex; }
}
