/* ============ CÓRTEX — Sistema de diseño (modo claro) ============ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e4e8f1;
  --text: #1c2333;
  --text-2: #5a6478;
  --text-3: #8b94a8;
  --primary: #4f46e5;
  --primary-soft: #eef0ff;
  --accent: #7c3aed;
  --money: #059669;
  --money-soft: #e7f7f0;
  --warn: #d97706;
  --warn-soft: #fef3e2;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --sidebar-bg: #171d33;
  --sidebar-text: #aab3cf;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(28,35,51,.06), 0 4px 16px rgba(28,35,51,.05);
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

#app { display: flex; min-height: 100vh; }

/* ============ Sidebar ============ */
#sidebar {
  width: 240px; min-width: 240px; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 14px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; font-size: 20px;
}
.brand-name { color: #fff; font-weight: 800; letter-spacing: 2px; font-size: 17px; }
.brand-sub { font-size: 11px; color: var(--sidebar-text); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sidebar nav { flex: 1; padding: 6px 10px; }
.nav-group {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.5px; color: #6b7594;
  padding: 16px 10px 6px; font-weight: 700;
}
#sidebar a {
  display: flex; align-items: center; gap: 10px; color: var(--sidebar-text);
  padding: 9px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 2px;
  transition: background .15s, color .15s;
}
#sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; }
#sidebar a.active { background: linear-gradient(90deg, rgba(99,102,241,.25), rgba(168,85,247,.15)); color: #fff; font-weight: 600; }
.sidebar-footer { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer a { display: flex; align-items: center; gap: 10px; color: var(--sidebar-text); padding: 9px 12px; border-radius: 10px; font-size: 14px; }
.sidebar-footer a:hover { background: rgba(255,255,255,.06); color: #fff; }

#menu-btn {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 60;
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); font-size: 18px; box-shadow: var(--shadow);
}
#sidebar-overlay { display: none; }

/* ============ Main / Player bar ============ */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#playerbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(90deg, #ffffff, #f7f5ff);
  border-bottom: 1px solid var(--border);
  padding: 10px 22px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.pb-avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; font-weight: 800; font-size: 15px;
  flex-shrink: 0;
}
.pb-info { min-width: 170px; flex: 1; max-width: 340px; }
.pb-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pb-rango { font-weight: 700; font-size: 13.5px; }
.pb-xp { font-size: 11.5px; color: var(--text-3); }
.pb-track { height: 8px; border-radius: 99px; background: #e8e6f7; margin-top: 5px; overflow: hidden; }
.pb-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  transition: width .6s cubic-bezier(.22,1,.36,1);
}
.pb-stats { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.pb-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
}
.pb-chip.btn:hover { border-color: var(--primary); color: var(--primary); }
#playerbar.levelup { animation: levelflash .9s ease; }
@keyframes levelflash {
  0%, 100% { box-shadow: none; }
  40% { box-shadow: inset 0 0 0 3px #a855f7, 0 0 30px rgba(168,85,247,.5); }
}

/* Misiones popover */
#misiones-pop {
  position: fixed; top: 64px; right: 18px; z-index: 55; width: 320px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(28,35,51,.18); padding: 14px; max-height: 70vh; overflow-y: auto;
}
#misiones-pop.hidden { display: none; }
.mision { display: flex; gap: 10px; align-items: flex-start; padding: 9px 6px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.mision:last-child { border-bottom: none; }
.mision.done { opacity: .55; }
.mision.done .m-tit { text-decoration: line-through; }
.m-pts { margin-left: auto; font-weight: 700; color: var(--accent); white-space: nowrap; font-size: 12.5px; }

/* ============ Vista ============ */
#view { padding: 24px 26px 60px; max-width: 1280px; width: 100%; margin: 0 auto; }
.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h1 { font-size: 22px; font-weight: 800; }
.view-head .sub { color: var(--text-2); font-size: 13.5px; width: 100%; }
.view-head .spacer { flex: 1; }

/* ============ Componentes ============ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 14px; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.kpi .k-value { font-size: 22px; font-weight: 800; margin-top: 4px; }
.kpi.good .k-value { color: var(--money); }
.kpi.bad .k-value { color: var(--danger); }
.kpi.warn .k-value { color: var(--warn); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 600; transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #4338ca; color: #fff; }
.btn.money { background: var(--money); border-color: var(--money); color: #fff; }
.btn.money:hover { background: #047857; }
.btn.danger-o { color: var(--danger); }
.btn.danger-o:hover { border-color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.wsp { color: #128c4b; }
.btn.wsp:hover { border-color: #25d366; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.badge.ok { background: var(--money-soft); color: var(--money); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.badge.muted { background: #eef0f5; color: var(--text-2); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input[type="search"], .toolbar select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px;
  font-family: inherit; background: var(--surface); min-width: 160px;
}
.toolbar input[type="search"] { flex: 1; max-width: 320px; }
.toolbar input:focus, .toolbar select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }

/* Tablas */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
th { text-align: left; padding: 11px 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); border-bottom: 1px solid var(--border); background: #fafbfe; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
td.num, th.num { text-align: right; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* Estados vacíos */
.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty .e-icon { font-size: 38px; margin-bottom: 8px; }
.empty p { margin-bottom: 14px; font-size: 14px; }

/* Pendientes */
.pend { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.pend:last-child { border-bottom: none; }
.pend .p-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.pend .p-dot.bad { background: var(--danger); }
.pend .p-dot.warn { background: var(--warn); }
.pend .p-dot.info { background: var(--primary); }
.pend a { margin-left: auto; font-weight: 600; font-size: 12.5px; white-space: nowrap; }

/* ============ Modal ============ */
#modal-root:not(:empty) {
  position: fixed; inset: 0; z-index: 70; background: rgba(23,29,51,.45);
  display: grid; place-items: center; padding: 16px; overflow-y: auto;
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.25);
  animation: pop .18s cubic-bezier(.22,1,.36,1);
}
.modal.wide { max-width: 760px; }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16.5px; font-weight: 800; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--text-3); padding: 4px 8px; border-radius: 8px; }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.field textarea { min-height: 74px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Constructor de ítems (cotización / venta) */
.items-editor { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.items-editor table { min-width: 0; font-size: 13px; }
.items-editor input, .items-editor select { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; }
.items-editor .qty { max-width: 66px; }
.items-editor .price { max-width: 110px; }
.totales { text-align: right; font-size: 14px; line-height: 1.9; padding: 4px 6px; }
.totales .tot { font-size: 18px; font-weight: 800; }

/* Stock +/- */
.stock-ctrl { display: inline-flex; align-items: center; gap: 6px; }
.stock-ctrl button { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; }
.stock-ctrl button:hover { border-color: var(--primary); color: var(--primary); }
.stock-ctrl .s-num { min-width: 34px; text-align: center; font-weight: 700; }

/* ============ Toasts ============ */
#toast-root { position: fixed; bottom: 18px; right: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: #21283f; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 13.5px;
  box-shadow: 0 8px 30px rgba(0,0,0,.3); animation: toastin .25s cubic-bezier(.22,1,.36,1);
  max-width: 340px; display: flex; gap: 9px; align-items: center;
}
.toast.xp { background: linear-gradient(90deg, #4f46e5, #7c3aed); font-weight: 700; }
.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }
.toast.level { background: linear-gradient(90deg, #b45309, #d97706); font-weight: 800; font-size: 15px; }
@keyframes toastin { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.out { animation: toastout .3s ease forwards; }
@keyframes toastout { to { transform: translateY(10px); opacity: 0; } }

/* ============ Organigrama ============ */
.org-nivel { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-bottom: 22px; }
.org-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px; width: 265px; }
.org-card .o-titulo { font-weight: 800; font-size: 14.5px; }
.org-card .o-persona { color: var(--text-2); font-size: 12.5px; margin: 2px 0 8px; }
.org-card .o-objetivo { font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; line-height: 1.45; }
.org-agente { background: linear-gradient(135deg, #f3f1ff, #fdf4ff); border: 1px solid #e6e0fa; border-radius: 11px; padding: 10px 12px; font-size: 12.5px; }
.org-agente .a-nombre { font-weight: 800; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.org-agente ul { margin: 6px 0 0 16px; color: var(--text-2); line-height: 1.5; }
.org-card .o-acciones { display: flex; gap: 6px; margin-top: 10px; }

/* ============ Academia ============ */
.ruta-card { margin-bottom: 14px; }
.ruta-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ruta-head h3 { font-size: 15.5px; font-weight: 800; flex: 1; }
.progress { height: 9px; border-radius: 99px; background: #e8e6f7; overflow: hidden; margin: 10px 0 12px; }
.progress .p-fill { height: 100%; background: linear-gradient(90deg, #10b981, #34d399); border-radius: 99px; transition: width .5s ease; }
.leccion { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.leccion:last-child { border-bottom: none; }
.leccion input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--money); cursor: pointer; }
.leccion .l-tit { cursor: pointer; }
.leccion .l-tit:hover { color: var(--primary); }
.leccion.done .l-tit { text-decoration: line-through; color: var(--text-3); }

/* Energía RR.HH. */
.energia-bar { height: 10px; border-radius: 99px; background: #eef0f5; overflow: hidden; }
.energia-bar .e-fill { height: 100%; border-radius: 99px; transition: width .4s; }

/* ============ Mundo RPG retro ============ */
.mundo-frame { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mundo-hud {
  width: 100%; max-width: 620px; background: #171d33; color: #d9e0f5; border-radius: 12px;
  padding: 10px 14px; font-size: 12.5px; line-height: 1.5; font-family: 'Courier New', monospace;
  border: 2px solid #2c3554;
}
.mundo-hud b { color: #ffd166; }
.mundo-map {
  display: grid; grid-template-columns: repeat(18, 34px); grid-auto-rows: 34px;
  border: 6px solid #171d33; border-radius: 10px; box-shadow: 0 10px 34px rgba(23,29,51,.35);
  background: #171d33; max-width: 100%; overflow-x: auto;
}
.mtile { display: grid; place-items: center; font-size: 19px; user-select: none; line-height: 1; }
.mtile.muro { background: #2c3554; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
.mtile.portal, .mtile.npc { cursor: pointer; }
.mtile.portal:hover, .mtile.npc:hover { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.mtile.jugador { animation: latido 1.2s ease infinite; }
@keyframes latido { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); } }
.mundo-pad { display: none; grid-template-columns: repeat(3, 52px); gap: 6px; }
.mundo-pad button { height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 16px; }
.mundo-leyenda { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 640px; }
@media (max-width: 860px) {
  .mundo-map { grid-template-columns: repeat(18, 26px); grid-auto-rows: 26px; }
  .mtile { font-size: 15px; }
  .mundo-pad { display: grid; }
}

/* ============ Centro de Mando (gráficos) ============ */
.cm-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 18px; }
.cm-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.cm-card .cm-tit { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.cm-card svg { width: 100%; height: auto; display: block; }

/* ============ Panel Diario (gestión visual) ============ */
.ind-chip { font-size: 12px; color: var(--text-2); background: #f7f8fc; border: 1px solid var(--border); border-radius: 9px; padding: 6px 9px; margin-top: 8px; line-height: 1.5; }
.pd-tabla { min-width: 900px; }
.pd-tabla th.pd-dia { padding: 8px 3px; text-align: center; font-size: 10.5px; }
.pd-tabla th.pd-hoy { background: var(--primary-soft); color: var(--primary); }
.pd-celda { padding: 4px 2px; text-align: center; }
.pd-btn {
  width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--border);
  background: #f4f5f9; font-size: 12px; font-weight: 800; color: #fff; line-height: 1;
}
.pd-btn:hover:not(:disabled) { border-color: var(--primary); }
.pd-btn:disabled { opacity: .35; cursor: default; }
.pd-btn.verde { background: var(--money); border-color: var(--money); }
.pd-btn.rojo { background: var(--danger); border-color: var(--danger); }
.pd-btn.pd-hoy:not(.verde):not(.rojo) { outline: 2px solid var(--primary); outline-offset: 1px; }

/* ============ Print (cotización PDF) ============ */
#print-area { display: none; }
@media print {
  body > #app, #menu-btn, #toast-root, #modal-root, #misiones-pop { display: none !important; }
  #print-area { display: block; font-family: var(--font); color: #111; }
  #print-area .ph { display: flex; justify-content: space-between; border-bottom: 3px solid #4f46e5; padding-bottom: 12px; margin-bottom: 18px; }
  #print-area h1 { font-size: 22px; }
  #print-area table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
  #print-area th, #print-area td { border: 1px solid #ccc; padding: 8px 10px; text-align: left; }
  #print-area .pnum { text-align: right; }
  #print-area .ptot { margin-top: 14px; text-align: right; font-size: 14px; line-height: 1.8; }
}

/* ============ Responsive ============ */
@media (max-width: 860px) {
  #sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s ease; height: 100vh; }
  #sidebar.open { transform: none; }
  #sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  #menu-btn { display: grid; place-items: center; }
  #playerbar { padding: 10px 14px 10px 64px; }
  #view { padding: 18px 14px 60px; }
  .field-row { grid-template-columns: 1fr; }
  .pb-stats { margin-left: 0; width: 100%; }
}

/* ============ Programa de Trabajo Diario ============ */
.view-sub { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.view-head { justify-content: space-between; }

.prog-progreso { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 16px; }
.prog-progreso-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; color: var(--text-2); margin-bottom: 8px; }
.prog-progreso-top span { font-weight: 800; color: var(--primary); }
.prog-bar { height: 9px; border-radius: 99px; background: var(--primary-soft); overflow: hidden; }
.prog-bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .4s ease; }

.prog-ia { background: linear-gradient(180deg, var(--primary-soft), var(--surface)); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 20px; }
.prog-ia-head { font-weight: 800; font-size: 14.5px; color: var(--primary); margin-bottom: 8px; }
.prog-ia-txt { font-size: 14px; line-height: 1.75; color: var(--text); }

.prog-grupo { margin-bottom: 20px; }
.prog-grupo-tit { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: var(--text-2); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.prog-grupo-n { background: var(--border); color: var(--text-2); border-radius: 99px; padding: 1px 9px; font-size: 12px; }

.prog-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 13px 15px; margin-bottom: 9px; transition: opacity .2s; }
.prog-card.done { opacity: .55; }
.prog-card.done .prog-tit { text-decoration: line-through; }
.prog-check { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border); background: var(--surface); color: #fff; font-weight: 900; font-size: 15px; display: grid; place-items: center; transition: all .15s; }
.prog-check:hover { border-color: var(--money); }
.prog-check.on { background: var(--money); border-color: var(--money); }
.prog-body { flex: 1; min-width: 0; }
.prog-tit { font-size: 14.5px; font-weight: 600; }
.prog-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.prog-badge { color: #fff; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.prog-motivo { font-size: 12.5px; color: var(--text-3); }
.prog-acciones { display: flex; gap: 6px; flex: none; }

.prog-vacio { text-align: center; padding: 44px 20px; color: var(--text-2); }
.prog-vacio h3 { font-size: 17px; margin: 8px 0 6px; color: var(--text); }
.prog-vacio p { font-size: 13.5px; line-height: 1.6; }

.prog-agregar { display: flex; gap: 8px; margin-top: 18px; }
.prog-agregar input { flex: 1; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; font-family: inherit; }
.prog-agregar input:focus { outline: none; border-color: var(--primary); }

@media (max-width: 640px) {
  .prog-card { flex-wrap: wrap; }
  .prog-acciones { width: 100%; padding-left: 40px; }
}

/* Banner de leads del bot dentro del Programa del Día */
.prog-leads-banner { display: flex; align-items: center; gap: 14px; background: linear-gradient(90deg, #10b981, #0ea5e9); color: #fff; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; cursor: pointer; box-shadow: var(--shadow); transition: transform .12s; }
.prog-leads-banner:hover { transform: translateY(-1px); }
.prog-leads-ico { font-size: 26px; }
.prog-leads-banner > div { flex: 1; line-height: 1.35; }
.prog-leads-flecha { font-size: 22px; font-weight: 800; }

/* ============ Bandeja de Leads ============ */
.leads-info { font-size: 13.5px; color: var(--text-2); margin-bottom: 14px; }
.leads-estado { text-align: center; padding: 44px 20px; color: var(--text-2); grid-column: 1 / -1; }
.leads-estado h3 { font-size: 17px; margin: 8px 0 6px; color: var(--text); }
.leads-estado p { font-size: 13.5px; line-height: 1.6; }
.leads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.lead-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 16px; display: flex; flex-direction: column; gap: 6px; }
.lead-top { display: flex; justify-content: space-between; align-items: center; }
.lead-badge { color: #fff; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 99px; }
.lead-hora { font-size: 12px; color: var(--text-3); }
.lead-nombre { font-size: 16px; font-weight: 700; margin-top: 2px; }
.lead-serv { font-size: 13.5px; color: var(--text-2); }
.lead-detalle { font-size: 13px; color: var(--text-2); font-style: italic; background: var(--bg); border-radius: 8px; padding: 7px 10px; margin: 2px 0; }
.lead-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.lead-monto { font-weight: 800; color: var(--money); font-size: 14px; }
.lead-acciones { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.lead-acciones .btn.primary { flex: 1; justify-content: center; }

/* Cotizar con IA */
#cia_necesidad { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 14px; resize: vertical; }
#cia_necesidad:focus { outline: none; border-color: var(--primary); }
.cia-hint { font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; min-height: 0; }
.cia-hint:not(:empty) { background: var(--primary-soft); border-radius: 8px; padding: 8px 11px; margin-bottom: 12px; }
