/* Panel funcional — limpio y profesional */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --navy: #0f2942;
  --navy-mid: #1a3a5c;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --green: #059669;
  --green-bg: #ecfdf5;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --red: #dc2626;
  --bg: #f1f5f9;
  --white: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
  --sidebar: 240px;
  --font: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.app-body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── LOGIN / ENTRADA ── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-brand {
  background: linear-gradient(160deg, var(--navy) 0%, #0c4a6e 100%);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-brand h1 { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.login-brand p { opacity: .85; font-size: 15px; max-width: 360px; line-height: 1.6; }
.login-brand ul { margin-top: 24px; list-style: none; }
.login-brand li { padding: 8px 0; font-size: 14px; opacity: .9; display: flex; gap: 10px; align-items: center; }
.login-brand li::before { content: '✓'; color: #4ade80; font-weight: 700; }

.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--white);
}

.login-box { width: 100%; max-width: 400px; }
.login-box h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-box > p { color: var(--muted); margin-bottom: 28px; font-size: 14px; }

.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.role-btn {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  background: var(--white);
  transition: all .15s;
  font-family: var(--font);
}

.role-btn:hover { border-color: var(--blue); background: var(--blue-light); }
.role-btn.selected { border-color: var(--blue); background: var(--blue-light); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.role-btn .icon { font-size: 28px; display: block; margin-bottom: 6px; }
.role-btn strong { display: block; font-size: 13px; color: var(--text); }
.role-btn span { font-size: 11px; color: var(--muted); }

.fg { margin-bottom: 16px; }
.fg label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.fg input, .fg select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font);
}
.fg input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: none;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.login-box .btn-primary { width: 100%; }
.btn-inline { width: auto; display: inline-flex; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--white); border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-green { background: var(--green); color: #fff; }

.login-note { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }
.login-note a { color: var(--blue); }

@media (max-width: 768px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { padding: 32px 24px; }
}

/* ── APP LAYOUT ── */
.app-layout { display: flex; min-height: 100vh; }

.app-sidebar {
  width: var(--sidebar);
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-head {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-head strong { font-size: 15px; display: block; }
.sidebar-head small { font-size: 11px; opacity: .6; }

.sidebar-role {
  margin: 12px 16px;
  padding: 10px 12px;
  background: rgba(255,255,255,.08);
  border-radius: 8px;
  font-size: 12px;
}

.sidebar-role b { display: block; font-size: 13px; margin-bottom: 2px; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.sidebar-nav a,
.sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active,
.sidebar-nav button.active { background: var(--blue); color: #fff; }

.sidebar-foot {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
}

.sidebar-foot a { color: rgba(255,255,255,.6); }

.app-main {
  flex: 1;
  margin-left: var(--sidebar);
  padding: 24px 28px 40px;
  min-width: 0;
}

.app-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.app-top h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.app-top p { color: var(--muted); font-size: 14px; margin-top: 4px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 24px;
  font-size: 13px;
}

.user-avatar {
  width: 32px; height: 32px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

/* KPI cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.kpi-card .label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.kpi-card .value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.kpi-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi-card .value.green { color: var(--green); }
.kpi-card .value.amber { color: var(--amber); }
.kpi-card .value.blue { color: var(--blue); }

/* Content grid */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.content-grid .full { grid-column: 1 / -1; }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.card-actions { display: flex; gap: 8px; flex-shrink: 0; }

.card-head h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* Progress */
.prog-wrap { margin-bottom: 20px; }
.prog-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.prog-label b { font-weight: 600; }
.prog-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.prog-bar div { height: 100%; background: var(--blue); border-radius: 4px; transition: width .3s; }
.prog-bar.green div { background: var(--green); }

/* Document list */
.doc-list { list-style: none; }
.doc-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.doc-list li:last-child { border-bottom: none; }

.doc-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.doc-icon.ok { background: var(--green-bg); }
.doc-icon.wait { background: var(--amber-bg); }
.doc-icon.no { background: #f1f5f9; color: var(--muted); }

.doc-info { flex: 1; min-width: 0; }
.doc-info strong { display: block; font-size: 13px; font-weight: 600; }
.doc-info span { font-size: 12px; color: var(--muted); }

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
  flex-shrink: 0;
}
.badge-ok { background: var(--green-bg); color: var(--green); }
.badge-warn { background: var(--amber-bg); color: var(--amber); }
.badge-no { background: #fef2f2; color: var(--red); }

/* Offers table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover { background: #f8fafc; }
.data-table .price { font-weight: 700; color: var(--navy); }
.data-table .actions { white-space: nowrap; text-align: right; }
.data-table .actions .btn { margin-left: 4px; }

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 4px; }
.tag-fob { background: #dbeafe; color: #1d4ed8; }
.tag-cif { background: #fef3c7; color: #b45309; }

/* Steps - proceso claro */
.steps-clear { display: flex; flex-direction: column; gap: 0; }
.step-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.step-item:last-child { border-bottom: none; }
.step-num {
  width: 48px; height: 48px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
}
.step-item h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.step-item p { font-size: 13px; color: var(--muted); line-height: 1.55; }

/* Flow horizontal simple */
.flow-simple {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 0;
}
.flow-box {
  flex: 1;
  min-width: 100px;
  text-align: center;
  padding: 14px 10px;
  background: var(--blue-light);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-mid);
}
.flow-arrow { color: var(--muted); font-size: 18px; }

.alert {
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.alert-info { background: var(--blue-light); border: 1px solid #bfdbfe; color: #1e40af; }
.alert-warn { background: var(--amber-bg); border: 1px solid #fde68a; color: #92400e; }
.alert-ok { background: var(--green-bg); border: 1px solid #a7f3d0; color: #065f46; }

.view { display: none; }
.view.active { display: block; }

.hidden { display: none !important; }

@media (max-width: 1024px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-sidebar { display: none; }
  .app-main { margin-left: 0; padding: 16px 16px 80px; }
  .kpi-row { grid-template-columns: 1fr; }
  .panel-mobile-nav { display: grid; }
}

/* Proceso page (public) */
.proceso-page { max-width: 900px; margin: 0 auto; padding: 40px 24px 80px; }
.proceso-page h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; color: var(--navy); }
.proceso-page .lead { font-size: 16px; color: var(--muted); margin-bottom: 32px; }
.role-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.role-section h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
.role-section .desc { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.req-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.req-table th, .req-table td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.req-table th { background: #f8fafc; font-weight: 600; }

.public-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.public-header a { font-weight: 600; color: var(--navy); text-decoration: none; }
.public-header .header-actions { display: flex; gap: 8px; align-items: center; }

.toc {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toc strong { font-size: 14px; margin-bottom: 4px; color: var(--navy); }
.toc a { font-size: 13px; color: var(--blue); text-decoration: none; padding: 4px 0; }
.toc a:hover { text-decoration: underline; }

.cta-box {
  text-align: center;
  margin-top: 40px;
  padding: 32px;
  background: var(--navy);
  color: #fff;
  border-radius: 12px;
}
.cta-box h2 { color: #fff; margin-bottom: 8px; font-size: 22px; }
.cta-box p { opacity: .85; margin-bottom: 20px; }
.cta-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta-box .btn-ghost { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); color: #fff; }

.panel-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 8px;
  z-index: 200;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.panel-mobile-nav button {
  border: none;
  background: none;
  font-size: 10px;
  color: var(--muted);
  padding: 8px 4px;
  border-radius: 8px;
  font-family: var(--font);
  cursor: pointer;
}
.panel-mobile-nav button.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }

.empty-msg { color: var(--muted); font-size: 13px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }

.panel-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: #fff;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  z-index: 999;
  opacity: 0;
  transform: translateY(12px);
  transition: all .25s;
  max-width: 360px;
}
.panel-toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 768px) {
  .panel-toast { left: 16px; right: 16px; bottom: 72px; max-width: none; }
}

/* Interactive UI */
.kpi-click { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.kpi-click:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); transform: translateY(-2px); }

.offer-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.offer-card-interactive {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--white);
  transition: box-shadow .2s, border-color .2s, transform .15s;
}
.offer-card-interactive:hover { border-color: var(--blue); box-shadow: 0 6px 16px rgba(37,99,235,.12); transform: translateY(-2px); }
.offer-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.offer-type { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.offer-card-interactive h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.offer-card-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.offer-card-price { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 12px; }
.offer-card-price small { font-size: 12px; font-weight: 500; color: var(--muted); }
.offer-card-foot { margin-top: auto; }

.flow-interactive { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flow-box-interactive {
  flex: 1; min-width: 90px; text-align: center; padding: 12px 8px;
  background: var(--white); border: 2px solid var(--border); border-radius: 8px;
  font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer;
  font-family: var(--font); transition: all .2s;
}
.flow-box-interactive .flow-n { display: block; font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.flow-box-interactive:hover { border-color: var(--blue); color: var(--blue); }
.flow-box-interactive.active { border-color: var(--blue); background: var(--blue-light); color: var(--blue); }
.flow-box-interactive.done { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.flow-detail { font-size: 13px; color: var(--text); margin-top: 12px; padding: 12px; background: #f8fafc; border-radius: 8px; line-height: 1.55; }
.flow-detail.pulse { animation: pulse-bg .4s ease; }
@keyframes pulse-bg { 0%,100%{background:#f8fafc} 50%{background:var(--blue-light)} }

.tabs-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  padding: 10px 18px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--white); font-weight: 600; font-size: 13px; cursor: pointer; font-family: var(--font);
}
.tab-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.tab-btn:hover:not(.active) { border-color: var(--blue); }

.panel-modal { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.panel-modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,41,66,.5); backdrop-filter: blur(2px); }
.modal-box {
  position: relative; background: var(--white); border-radius: 12px; padding: 28px;
  max-width: 440px; width: 100%; max-height: calc(100vh - 40px); overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
  animation: modal-in .25s ease;
}
.modal-box.offer-modal {
  max-width: 920px;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
.modal-box.offer-modal > h3,
.modal-box.offer-modal > .modal-sub,
.modal-box.offer-modal > .modal-bolsa-ref,
.modal-box.offer-modal > .modal-bolsa-price {
  margin-left: 24px;
  margin-right: 24px;
}
.modal-box.offer-modal > h3 { margin-top: 20px; }
.modal-box.offer-modal > .modal-sub { margin-bottom: 10px; }
.modal-box.offer-modal .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(255,255,255,.9), #fff);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  margin: 0;
}
@keyframes modal-in { from { opacity:0; transform:scale(.95) translateY(10px) } to { opacity:1; transform:none } }
.modal-box h3 { font-size: 18px; margin-bottom: 6px; }
.modal-sub { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.modal-note { font-size: 13px; margin-top: 12px; color: var(--navy); font-weight: 500; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

.upload-zone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 32px 20px; text-align: center;
  cursor: pointer; transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.has-file { border-color: var(--blue); background: var(--blue-light); }
.upload-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.upload-link { color: var(--blue); font-weight: 600; cursor: pointer; }

.deal-steps { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.deal-step {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  background: #f8fafc; font-size: 13px; color: var(--muted); transition: all .3s;
}
.deal-step span { width: 28px; height: 28px; border-radius: 50%; background: var(--border); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.deal-step.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }
.deal-step.active span { background: var(--blue); color: #fff; }
.deal-step.done { background: var(--green-bg); color: var(--green); }
.deal-step.done span { background: var(--green); color: #fff; }

.price-preview { font-size: 14px; margin-bottom: 16px; padding: 12px; background: #f8fafc; border-radius: 8px; }

.op-list { display: flex; flex-direction: column; gap: 16px; }
.op-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.op-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.op-card-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

.timeline { display: flex; gap: 4px; flex-wrap: wrap; }
.timeline-step {
  flex: 1; min-width: 70px; text-align: center; padding: 8px 4px; font-size: 10px;
  background: #f1f5f9; border-radius: 6px; color: var(--muted); position: relative;
}
.timeline-step span { display: block; font-weight: 700; font-size: 12px; margin-bottom: 2px; }
.timeline-step.done { background: var(--green-bg); color: var(--green); }
.timeline-step.current { background: var(--blue-light); color: var(--blue); box-shadow: 0 0 0 2px var(--blue); }

/* Marketplace dashboard */
.market-toolbar { margin-bottom: 20px; }
.market-search-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
#market-search-btn { flex-shrink: 0; }
.market-search-wrap {
  flex: 1; min-width: 220px; position: relative; display: flex; align-items: center;
}
.market-search-wrap .search-icon { position: absolute; left: 14px; font-size: 14px; pointer-events: none; }
.market-search {
  width: 100%; padding: 12px 40px 12px 40px; border: 2px solid var(--border);
  border-radius: 10px; font-size: 14px; font-family: var(--font);
}
.market-search:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.search-clear {
  position: absolute; right: 10px; border: none; background: #e2e8f0; width: 24px; height: 24px;
  border-radius: 50%; cursor: pointer; font-size: 11px;
}
.market-select {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: var(--font); background: var(--white); min-width: 130px;
}
.market-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.filter-chip {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--white); font-size: 12px; font-weight: 600; cursor: pointer; font-family: var(--font);
  transition: all .15s;
}
.filter-chip:hover { border-color: var(--blue); }
.filter-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.market-stats { font-size: 13px; color: var(--muted); }

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.market-card {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--white); transition: box-shadow .2s, transform .15s;
  display: flex; flex-direction: column;
}
.market-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); transform: translateY(-2px); }
.market-card-img {
  height: 72px; display: flex; align-items: center; justify-content: center;
  position: relative;
}
.market-card-icon { font-size: 32px; }
.market-verified { position: absolute; top: 8px; right: 8px; font-size: 9px !important; }
.market-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.market-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.market-cat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; }
.market-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.market-specs { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.market-meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px;
  font-size: 11px; margin-bottom: 12px;
}
.market-meta-grid b { display: block; color: var(--muted); font-weight: 500; font-size: 10px; text-transform: uppercase; }
.market-card-price { font-size: 18px; font-weight: 700; color: var(--navy); margin-bottom: 12px; }
.market-card-price small { font-size: 12px; font-weight: 500; color: var(--muted); display: block; margin-top: 2px; }
.market-card-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.market-empty {
  text-align: center; padding: 48px 24px; color: var(--muted);
}
.market-empty span { font-size: 40px; display: block; margin-bottom: 12px; }

.detail-table { width: 100%; font-size: 13px; border-collapse: collapse; margin-top: 12px; }
.detail-table td { padding: 10px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.detail-table td:first-child { color: var(--muted); width: 40%; font-weight: 500; }
.detail-table td strong { color: var(--navy); }

.panel-modal.open { display: flex; }

/* Deal room + pago completo */
.deal-room-head {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.deal-room-title h2 { font-size: 20px; margin-bottom: 4px; }
.deal-room-title p { font-size: 13px; color: var(--muted); }

.deal-pipeline { display: flex; flex-wrap: wrap; gap: 6px; }
.pipe-step {
  flex: 1; min-width: 72px; max-width: 100px;
  text-align: center; padding: 10px 6px;
  border: 2px solid var(--border); border-radius: 8px;
  background: #f8fafc; font-size: 10px; font-weight: 600; color: var(--muted);
  transition: all .25s;
}
.pipe-step .pipe-icon { display: block; font-size: 18px; margin-bottom: 4px; }
.pipe-step .pipe-label { line-height: 1.2; }
.pipe-step.done { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.pipe-step.current { border-color: var(--blue); background: var(--blue-light); color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.2); transform: scale(1.04); }
.pipe-step.pending { opacity: .55; }
.pipe-desc { font-size: 13px; margin-top: 14px; padding: 12px; background: #f8fafc; border-radius: 8px; }

.payment-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.payment-head h3 { font-size: 16px; }
.payment-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .payment-grid { grid-template-columns: 1fr 1fr; } }
.payment-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.payment-box.highlight { background: var(--navy); color: #fff; border-color: var(--navy); }
.payment-box.highlight .pb-label { color: rgba(255,255,255,.7); }
.payment-box .pb-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.payment-box .pb-value { font-size: 14px; font-weight: 600; }
.payment-box .pb-value.big { font-size: 22px; }
.payment-box .pb-value.mono { font-family: ui-monospace, monospace; font-size: 12px; }
.text-green { color: var(--green); }

.payment-log {
  margin-top: 16px; padding: 14px; background: #0f172a; color: #e2e8f0;
  border-radius: 10px; font-size: 12px; font-family: ui-monospace, monospace;
}
.payment-log strong { display: block; margin-bottom: 8px; color: #94a3b8; font-family: var(--font); }
.log-line { padding: 4px 0; border-bottom: 1px solid #1e293b; }
.log-line span { color: #64748b; margin-right: 10px; }

.chat-mock { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow-y: auto; }
.chat-msg { padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; max-width: 95%; }
.chat-msg.system { background: #f1f5f9; color: var(--muted); text-align: center; font-size: 12px; align-self: center; }
.chat-msg.buyer { background: var(--blue-light); align-self: flex-end; }
.chat-msg.seller { background: var(--green-bg); align-self: flex-start; }

/* Guía demo + API banco */
.demo-entry-box {
  background: var(--blue-light);
  border: 2px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}
.demo-entry-box strong { display: block; font-size: 13px; margin-bottom: 10px; color: var(--navy); }
.demo-entry-btn { width: 100%; margin-bottom: 8px; justify-content: center; }
.demo-entry-btn:last-child { margin-bottom: 0; }

.demo-guide-page { }
.demo-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.demo-steps { display: flex; flex-direction: column; gap: 12px; }
.demo-step-card {
  display: grid; grid-template-columns: 48px 1fr; gap: 16px;
  padding: 16px; border: 1px solid var(--border); border-radius: 10px;
  background: #fafbfc; transition: border-color .2s;
}
.demo-step-card:hover { border-color: var(--blue); }
.demo-step-num {
  width: 48px; height: 48px; background: var(--blue); color: #fff;
  border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.demo-step-body h3 { font-size: 15px; margin-bottom: 4px; }
.demo-step-body p { font-size: 13px; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }

.api-flow-diagram {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 20px; background: #f8fafc; border-radius: 12px; margin-bottom: 20px;
}
.api-node {
  flex: 1; min-width: 120px; text-align: center; padding: 16px;
  border-radius: 10px; border: 2px solid var(--border);
}
.api-node.platform { background: var(--blue-light); border-color: var(--blue); }
.api-node.bank { background: #fef3c7; border-color: #d97706; }
.api-node.parties { background: var(--green-bg); border-color: var(--green); }
.api-node strong { display: block; font-size: 13px; }
.api-node small { font-size: 11px; color: var(--muted); }
.api-arrow { font-size: 12px; font-weight: 600; color: var(--muted); }

.api-block {
  border: 1px solid var(--border); border-radius: 12px; margin-bottom: 16px; overflow: hidden;
  transition: box-shadow .3s;
}
.api-block.api-fired { box-shadow: 0 0 0 3px rgba(37,99,235,.25); }
.api-block-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: #0f172a; color: #e2e8f0;
}
.api-method {
  background: var(--green); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 8px; border-radius: 4px;
}
.api-endpoint { font-size: 13px; color: #94a3b8; }
.api-block-title { padding: 12px 16px 0; font-weight: 600; font-size: 14px; }
.api-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
@media (max-width: 768px) { .api-cols { grid-template-columns: 1fr; } }
.api-col { padding: 12px 16px 16px; }
.api-col-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.api-code {
  background: #1e293b; color: #e2e8f0; padding: 14px; border-radius: 8px;
  font-size: 11px; line-height: 1.5; overflow-x: auto; margin: 0;
  font-family: ui-monospace, 'Cascadia Code', monospace;
}
.api-code.response { background: #0c4a6e; }
.api-code.highlight { animation: api-flash .6s ease; }
@keyframes api-flash { 0%,100%{background:#0c4a6e} 50%{background:#0369a1} }
.api-block .btn { margin: 0 16px 16px; }

.publish-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .publish-preview { grid-template-columns: 1fr; } }
.publish-preview-card {
  border: 2px solid var(--blue); border-radius: 12px; padding: 20px;
  background: linear-gradient(135deg, var(--blue-light), #fff);
}
.publish-preview-card.large { max-width: 480px; }
.publish-preview-card h3 { font-size: 18px; margin: 8px 0; }
.deriv-docs li { cursor: default; }

/* Bolsa de valores — ticker */
.market-ticker-wrap { margin: 0 0 20px; }

.market-ticker {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  border-radius: 12px; overflow: hidden;
  border: 1px solid #334155;
  box-shadow: 0 4px 20px rgba(15,23,42,.25);
}
.market-ticker-loading {
  padding: 16px 20px; color: #e2e8f0;
}
.ticker-loading-inner { display: flex; align-items: center; gap: 14px; }
.ticker-loading-inner strong { display: block; font-size: 14px; }
.ticker-loading-inner span { font-size: 12px; color: #94a3b8; }
.ticker-spinner {
  width: 22px; height: 22px; border: 3px solid #334155;
  border-top-color: #38bdf8; border-radius: 50%;
  animation: ticker-spin .8s linear infinite;
}
@keyframes ticker-spin { to { transform: rotate(360deg); } }

.ticker-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: rgba(0,0,0,.25);
  border-bottom: 1px solid #334155; font-size: 12px; color: #cbd5e1;
}
.ticker-title { color: #f8fafc; font-size: 13px; }
.ticker-source { color: #64748b; font-size: 11px; }
.ticker-time { color: #94a3b8; margin-left: auto; font-size: 11px; }
.ticker-refresh { color: #38bdf8 !important; border-color: #334155 !important; font-size: 11px !important; }
.ticker-live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(16,185,129,.2); color: #34d399;
  font-size: 10px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
  letter-spacing: .05em;
}
.ticker-live-badge.offline { background: rgba(251,191,36,.15); color: #fbbf24; }
.ticker-live-badge .live-dot { width: 6px; height: 6px; }

.ticker-scroll-wrap { overflow: hidden; padding: 12px 0; }
.ticker-scroll {
  display: flex; gap: 24px; width: max-content;
  animation: ticker-marquee 40s linear infinite;
}
.ticker-scroll:hover { animation-play-state: paused; }
@keyframes ticker-marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-quote {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  padding: 8px 16px; background: rgba(255,255,255,.06);
  border: 1px solid #334155; border-radius: 8px; color: #e2e8f0; font-size: 12px;
}
.ticker-quote.fallback { opacity: .7; }
.tq-exchange {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  background: #1d4ed8; color: #fff; padding: 2px 6px; border-radius: 4px;
}
.tq-label { font-weight: 600; color: #f1f5f9; white-space: nowrap; }
.tq-symbol { font-size: 10px; color: #64748b; background: #0f172a; padding: 2px 6px; border-radius: 4px; }
.tq-price { font-size: 15px; font-weight: 700; color: #38bdf8; white-space: nowrap; }
.mkt-chg { font-size: 11px; font-weight: 600; white-space: nowrap; }
.mkt-chg.up { color: #34d399; }
.mkt-chg.down { color: #f87171; }
.mkt-chg small { font-weight: 500; opacity: .85; }

.ticker-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; background: rgba(0,0,0,.2);
  font-size: 10px; color: #64748b; border-top: 1px solid #334155;
}
.ticker-formula-hint { color: #475569; }

.market-bolsa-tag {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 8px; padding: 8px 10px;
  background: linear-gradient(90deg, #eff6ff, #ecfdf5);
  border: 1px solid #bfdbfe; border-radius: 8px;
  font-size: 10px; color: #1e40af; line-height: 1.4;
}
.market-bolsa-tag .bolsa-icon { flex-shrink: 0; }
.market-formula-line { color: #1d4ed8; font-weight: 500; }
.modal-bolsa-ref {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 8px; font-size: 13px; color: #1e3a8a; margin-bottom: 12px;
}
.modal-bolsa-ref .bolsa-icon { font-size: 16px; }
.modal-bolsa-price {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; background: #f0fdf4; border: 1px solid #86efac;
  border-radius: 8px; margin-bottom: 14px; font-size: 13px;
}
.modal-bolsa-price span { color: var(--muted); }
.modal-bolsa-price strong { font-size: 18px; color: #15803d; }
.modal-bolsa-price small { color: var(--muted); font-size: 11px; }
.offer-discount { color: #15803d; font-weight: 600; }
.offer-premium { color: #b45309; font-weight: 600; }
.buy-form {
  padding: 0 24px 18px;
}
.buy-form-main {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(340px, 1.15fr);
  gap: 18px;
  align-items: start;
}
.buy-fields {
  position: sticky;
  top: 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.buy-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 0;
}
.buy-form-grid .fg.full { grid-column: auto; }
.buy-form-grid input,
.buy-form-grid select {
  min-height: 42px;
}
.fg-hint { font-size: 11px; color: var(--muted); display: block; margin-top: 4px; }
.buy-breakdown-preview {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; margin-top: 0; max-height: min(56vh, 520px); overflow-y: auto;
}
.buy-breakdown-preview h4 { font-size: 13px; margin-bottom: 10px; }
.buy-breakdown-preview .detail-table td {
  padding: 9px 10px;
  font-size: 12px;
}
.buy-breakdown-preview .detail-table td:first-child {
  width: 52%;
}
.breakdown-note { font-size: 12px; color: var(--muted); margin-top: 10px; }
.payment-breakdown .row-subtotal td { border-top: 2px solid var(--border); }
.payment-breakdown .row-highlight td { background: var(--blue-light); }
.text-blue { color: var(--blue); }

@media (max-width: 900px) {
  .panel-modal { align-items: stretch; padding: 10px; }
  .modal-box.offer-modal {
    max-width: none;
    height: calc(100vh - 20px);
  }
  .buy-form-main {
    grid-template-columns: 1fr;
  }
  .buy-fields {
    position: static;
  }
  .buy-breakdown-preview {
    max-height: 38vh;
  }
}

.negotiation-panel .seller-quote-box {
  padding: 14px; background: var(--green-bg); border-radius: 8px; margin-bottom: 14px;
}
.neg-hint { font-size: 13px; color: var(--muted); margin: 10px 0; }
.neg-actions { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.counter-offer-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.counter-offer-row input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; }
.quote-history { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; }
.quote-line { padding: 4px 0; color: var(--muted); }
.quote-line span { color: var(--navy); font-weight: 600; margin-right: 8px; }
.payment-locked { padding: 20px; text-align: center; background: #f8fafc; border-radius: 8px; }
