/* Estilos compartidos de las demos tipo aplicación (CRM, ERP, Inventario, Agenda) */
:root {
    --accent: #2563eb; --accent-hover: #1d4ed8; --accent-2: #0ea5e9;
    --bg: #020202; --surface: #0a0a0a; --surface-2: #111; --line: rgba(255,255,255,.07);
    --text: #fff; --muted: rgba(255,255,255,.55); --ok: #10b981; --warn: #f59e0b; --bad: #ef4444;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: 'Manrope', sans-serif; letter-spacing: -.02em; }

.app { display: grid; grid-template-columns: 15rem 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: .35rem; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: .65rem; font-family: 'Manrope'; font-weight: 800; padding: 0 .5rem 1.25rem; font-size: 1.05rem; }
.brand .logo { width: 2rem; height: 2rem; border-radius: .55rem; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; font-size: .8rem; }
.side button.nav { background: none; border: none; color: var(--muted); text-align: left; padding: .7rem .85rem; border-radius: .6rem; display: flex; align-items: center; gap: .7rem; font-size: .9rem; font-weight: 500; transition: .2s; }
.side button.nav i { width: 1.05rem; height: 1.05rem; }
.side button.nav:hover { background: rgba(255,255,255,.04); color: var(--text); }
.side button.nav.active { background: rgba(37,99,235,.14); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side .grow { flex: 1; }
.side .user { display: flex; align-items: center; gap: .65rem; padding: .75rem; border: 1px solid var(--line); border-radius: .75rem; font-size: .8rem; }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; background: rgba(37,99,235,.25); border: 1px solid rgba(37,99,235,.4); display: grid; place-items: center; font-size: .7rem; font-weight: 700; flex-shrink: 0; }

.main { padding: 1.75rem 2rem 6rem; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.top h1 { font-size: 1.6rem; font-weight: 800; }
.top p { color: var(--muted); font-size: .88rem; }
.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.search { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: .6rem .9rem; border-radius: .6rem; font-size: .88rem; outline: none; min-width: 14rem; }
.search:focus { border-color: rgba(37,99,235,.6); }
.btn { background: var(--accent); color: #fff; border: none; padding: .6rem 1.1rem; border-radius: .6rem; font-weight: 600; font-size: .86rem; transition: .2s; }
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn.ghost { background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.btn.ghost:hover { background: rgba(255,255,255,.09); }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: 1.25rem; }
.stat .label { font-size: .72rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.stat .value { font-family: 'Manrope'; font-size: 1.7rem; font-weight: 800; margin: .25rem 0; }
.stat .delta { font-size: .78rem; font-weight: 600; }
.up { color: var(--ok); } .down { color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; }
.card h3 small { font-family: 'Inter'; font-weight: 400; color: var(--muted); font-size: .76rem; }

table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
td { padding: .8rem .75rem; border-bottom: 1px solid rgba(255,255,255,.04); }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255,255,255,.025); }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: .2rem .6rem; border-radius: 9999px; font-size: .72rem; font-weight: 600; border: 1px solid; }
.pill.ok { color: var(--ok); background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.25); }
.pill.warn { color: var(--warn); background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); }
.pill.bad { color: var(--bad); background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.25); }
.pill.info { color: var(--accent-2); background: rgba(14,165,233,.08); border-color: rgba(14,165,233,.25); }
.cell-user { display: flex; align-items: center; gap: .65rem; }
.muted { color: var(--muted); }

/* Gráfico de barras CSS */
.bars { display: flex; align-items: flex-end; gap: .6rem; height: 11rem; padding-top: .5rem; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; height: 100%; justify-content: flex-end; }
.bars .bar { width: 100%; border-radius: .35rem .35rem 0 0; background: linear-gradient(to top, rgba(37,99,235,.15), var(--accent)); transition: height .5s; min-height: 4px; }
.bars .col:hover .bar { background: linear-gradient(to top, rgba(14,165,233,.2), var(--accent-2)); }
.bars span { font-size: .68rem; color: var(--muted); }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(14rem, 1fr)); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.col-k { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; min-height: 22rem; }
.col-k.drag-over { border-color: var(--accent); background: rgba(37,99,235,.05); }
.col-k h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; flex-direction: column; gap: .15rem; margin-bottom: .9rem; }
.col-k h4 span { font-size: .72rem; text-transform: none; letter-spacing: 0; color: var(--text); font-family: 'Inter'; font-weight: 500; }
.deal { background: var(--surface-2); border: 1px solid var(--line); border-radius: .75rem; padding: .85rem; margin-bottom: .65rem; cursor: grab; transition: .2s; }
.deal:hover { border-color: rgba(37,99,235,.4); transform: translateY(-2px); }
.deal.dragging { opacity: .4; }
.deal b { display: block; font-size: .9rem; }
.deal .m { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); margin-top: .4rem; }
.deal .m strong { color: var(--text); }

.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab { background: none; border: 1px solid var(--line); color: var(--muted); padding: .45rem .9rem; border-radius: 9999px; font-size: .8rem; }
.tab.active, .tab:hover { background: rgba(37,99,235,.14); color: var(--text); border-color: rgba(37,99,235,.4); }

.view { display: none; } .view.active { display: block; animation: fade .3s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.75); backdrop-filter: blur(6px); display: none; place-items: center; z-index: 50; padding: 1rem; }
.modal.open { display: grid; }
.modal .box { background: var(--surface); border: 1px solid rgba(37,99,235,.25); border-radius: 1.1rem; padding: 1.75rem; width: 100%; max-width: 28rem; }
.modal h3 { margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .85rem; font-size: .8rem; color: var(--muted); }
.field input, .field select { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: .65rem .8rem; border-radius: .55rem; font-size: .9rem; outline: none; }
.field input:focus, .field select:focus { border-color: rgba(37,99,235,.6); }

/* Banner de demo */
.demo-banner { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 100; background: rgba(10,10,10,.92); backdrop-filter: blur(12px); border: 1px solid rgba(37,99,235,.35); border-radius: 9999px; padding: .55rem .6rem .55rem 1.1rem; display: flex; align-items: center; gap: .9rem; font-size: .78rem; box-shadow: 0 10px 40px rgba(0,0,0,.6); white-space: nowrap; max-width: calc(100vw - 1.5rem); }
.demo-banner span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.demo-banner a { color: #fff; background: rgba(255,255,255,.1); padding: .4rem .85rem; border-radius: 9999px; font-weight: 600; }
.demo-banner a.cta { background: var(--accent); }
.demo-banner a:hover { filter: brightness(1.15); }

@media (max-width: 1000px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .75rem; }
    .side .brand { padding: 0 .5rem; } .side .grow, .side .user { display: none; }
    .cards { grid-template-columns: repeat(2, 1fr); } .grid2 { grid-template-columns: 1fr; }
    .main { padding: 1.25rem 1rem 6rem; }
}
@media (max-width: 600px) { .demo-banner span { display: none; } .search { min-width: 0; width: 100%; } }

/* Ajustes para temas claros */
body.light .btn.ghost { background: rgba(0,0,0,.04); color: var(--text); border-color: var(--line); }
body.light .btn.ghost:hover { background: rgba(0,0,0,.08); }
body.light .side button.nav:hover { background: rgba(0,0,0,.04); color: var(--text); }
body.light tbody tr:hover { background: rgba(0,0,0,.03); }
body.light td { border-bottom-color: rgba(0,0,0,.06); }
body.light [style*="rgba(255,255,255,.06)"] { background: rgba(0,0,0,.08) !important; }
body.light .avatar { color: var(--text); }

@media (max-width: 1000px) {
  .app { grid-template-columns: minmax(0, 1fr) !important; }
  .stat .label, th, .pill, .field, .muted { font-size: .78rem; }
  .btn, .tab { min-height: 2.6rem; }
  .btn.ghost { padding-inline: .9rem; }
  .side button.nav { min-height: 2.6rem; font-size: .85rem; }
  .search, .field input, .field select { font-size: 16px; }
  .kanban { scroll-snap-type: x proximity; }
  .col-k { scroll-snap-align: start; }
}

/* Evita que el contenido ancho (kanban, tablas) ensanche la columna principal */
.main { width: 100%; min-width: 0; }

@media (max-width: 1000px) {
  .book > .card, .book > div, .card { min-width: 0; }
  .days { max-width: 100%; }
  .pill, .stat .label, .stat .delta { font-size: .76rem !important; }
  .top h1 { font-size: 1.35rem; }
}
@media (max-width: 600px) {
  .cards, .cards[style] { grid-template-columns: 1fr !important; }
  .grid2 { grid-template-columns: minmax(0, 1fr) !important; }
  .book { grid-template-columns: minmax(0, 1fr) !important; }
}

/* CRM: mover tarjetas con botones (el arrastre con el dedo no funciona en celular) */
.deal .mv { display: flex; gap: .45rem; margin-top: .75rem; }
.deal .mv button { flex: 1; min-height: 2.5rem; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: .6rem; font: 600 .8rem inherit; font-family: inherit; transition: .2s; }
.deal .mv button:hover:not(:disabled) { color: var(--text); border-color: var(--accent); background: rgba(37,99,235,.08); }
.deal .mv button:disabled { opacity: .3; cursor: not-allowed; }
.deal.moved { animation: movedPulse .9s ease; }
@keyframes movedPulse { 0% { box-shadow: 0 0 0 0 var(--accent); } 40% { box-shadow: 0 0 0 6px rgba(124,58,237,.25); } 100% { box-shadow: none; } }
@media (hover: hover) and (pointer: fine) {
  .deal .mv { display: none; }
  .deal:hover .mv { display: flex; }
}
.kanban { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
