/* Estilos de la demo del ERP */

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

/* ----- componentes nuevos (ERP rico) ----- */
.btn-sm { padding: .35em .8em; font-size: .8rem; }
.pill.muted { background: #eef0f4; color: var(--c-muted); }
.grid2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px){ .grid2col { grid-template-columns: 1fr; } }
.rowline { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--c-line); }
.rowline:last-child { border-bottom: 0; }

.cards3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
@media (max-width: 900px){ .cards3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px){ .cards3 { grid-template-columns: 1fr; } }
.pcard { background:#fff; border:1px solid var(--c-line); border-radius:12px; padding:16px; cursor:pointer; transition:border-color .15s, box-shadow .15s; }
.pcard:hover { border-color: var(--c-primary); box-shadow: var(--shadow-sm); }

.pbar { height:7px; background:#eef2f7; border-radius:6px; overflow:hidden; margin:12px 0 4px; }
.pbar-in { height:100%; background:linear-gradient(90deg,#5B2EFF,#8B6DFF); }

.rag { display:inline-flex; align-items:center; gap:.4em; font-size:.74rem; font-weight:700; color:var(--c-ink-soft); }
.rag::before { content:""; width:9px; height:9px; border-radius:50%; background:var(--rc,#999); }

/* Kanban */
.kanban { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
@media (max-width: 860px){ .kanban { grid-template-columns:repeat(2,1fr); } }
.kcol { background:#f4f6f9; border:1px solid var(--c-line); border-radius:12px; padding:10px; min-height:80px; }
.kcol-h { font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--c-muted); padding:4px 6px 10px; display:flex; align-items:center; gap:6px; }
.kcount { background:#fff; border:1px solid var(--c-line); border-radius:999px; padding:0 .5em; font-size:.72rem; }
.kcard { background:#fff; border:1px solid var(--c-line); border-radius:10px; padding:10px; margin-bottom:8px; box-shadow:var(--shadow-sm); }
.kc-title { font-size:.86rem; font-weight:600; color:var(--c-ink); display:flex; align-items:center; gap:7px; }
.kc-meta { display:flex; align-items:center; justify-content:space-between; margin-top:8px; }
.kc-av { font-size:.72rem; font-weight:700; color:var(--c-primary); background:var(--c-primary-l); padding:.15em .6em; border-radius:999px; }
.prio { width:8px; height:8px; border-radius:50%; flex:0 0 auto; background:#bbb; }
.prio.Alta { background:#f0a500; } .prio.Urgente { background:#d6453d; } .prio.Normal { background:#5B2EFF; } .prio.Baja { background:#bbb; }
.kc-rel { margin-top:8px; }

/* Pestañas de proyecto */
.tabs { display:flex; gap:6px; border-bottom:1px solid var(--c-line); margin-top:14px; }
.tab { border:0; background:transparent; font-family:inherit; font-weight:600; font-size:.9rem; color:var(--c-muted); padding:.7em 1em; cursor:pointer; border-bottom:2px solid transparent; }
.tab.active { color:var(--c-primary); border-bottom-color:var(--c-primary); }

/* Fichaje y vacaciones */
.ficha { text-align:center; }
.ficha-state { color:var(--c-muted); font-size:.9rem; }
.crono { font-family:var(--font-head,inherit); font-size:2.2rem; font-weight:800; letter-spacing:1px; margin:8px 0; color:var(--c-ink); }
.chips { display:flex; gap:6px; justify-content:center; margin-bottom:14px; }
.chip { font-size:.78rem; font-weight:600; padding:.3em .8em; border-radius:999px; background:#eef0f4; color:var(--c-ink-soft); }
.chip.active { background:var(--c-primary); color:#fff; }
.vac { text-align:center; }
.vac-big { font-family:var(--font-head,inherit); font-size:2.6rem; font-weight:800; color:var(--c-primary); line-height:1; }

/* Buzón */
.buzon { display:grid; grid-template-columns:180px 280px 1fr; gap:12px; }
@media (max-width: 900px){ .buzon { grid-template-columns:1fr; } }
.buzcols { padding:10px; }
.bz-folder { padding:.5em .7em; border-radius:8px; font-size:.88rem; font-weight:600; color:var(--c-ink-soft); cursor:pointer; }
.bz-folder.active { background:var(--c-primary-l); color:var(--c-primary-d); }
.buzlist { padding:0; overflow:hidden; }
.bz-hilo { padding:12px 14px; border-bottom:1px solid var(--c-line); cursor:pointer; }
.bz-hilo.active { background:var(--c-primary-l); }
.bz-msg { background:#f4f6f9; border-radius:10px; padding:12px 14px; margin:12px 0; font-size:.9rem; }
.bz-reply { width:100%; border:1.5px solid var(--c-line); border-radius:8px; padding:.6em; font-family:inherit; margin-bottom:8px; }

/* Aviso de demo */
.demo-banner {
  background: var(--c-primary); color: #fff; text-align: center;
  font-size: .85rem; font-weight: 600; padding: .55em 1em;
}
.demo-banner a { color: #fff; text-decoration: underline; }
.demo-banner b { color: #fff; }

/* Topbar */
.erp-top {
  background: var(--c-primary); color: #fff; display: flex; align-items: center;
  justify-content: space-between; padding: 0 18px; height: 56px; gap: 14px;
}
.erp-top .co { display: flex; align-items: center; gap: .6em; font-weight: 700; }
.erp-top .co .av { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-weight: 800; }
.erp-top .co small { display: block; font-weight: 500; opacity: .8; font-size: .72rem; }
.erp-top .right { display: flex; align-items: center; gap: 10px; }

/* Selector de rol */
.role-switch { display: flex; background: rgba(255,255,255,.14); border-radius: 8px; padding: 3px; }
.role-switch button {
  border: 0; background: transparent; color: #eaf6f6; font-family: inherit;
  font-weight: 650; font-size: .82rem; padding: .35em .8em; border-radius: 6px; cursor: pointer;
}
.role-switch button.active { background: #fff; color: var(--c-primary); }
.btn-reset { background: rgba(255,255,255,.16); border: 0; color: #fff; font-family: inherit; font-weight: 600; font-size: .8rem; padding: .45em .8em; border-radius: 7px; cursor: pointer; }
.btn-reset:hover { background: rgba(255,255,255,.28); }

/* Layout app */
.erp-body { display: flex; flex: 1; min-height: 0; }
.erp-nav { width: 220px; background: #fff; border-right: 1px solid var(--c-line); padding: 14px 10px; flex: 0 0 auto; }
.erp-nav button {
  display: flex; align-items: center; gap: .7em; width: 100%; text-align: left;
  border: 0; background: transparent; font-family: inherit; font-size: .92rem; font-weight: 600;
  color: var(--c-ink-soft); padding: .65em .8em; border-radius: 9px; cursor: pointer; margin-bottom: 2px;
}
.erp-nav button .ic { width: 22px; text-align: center; }
.erp-nav button:hover { background: var(--c-bg); color: var(--c-ink); }
.erp-nav button.active { background: var(--c-primary-l); color: var(--c-primary-d); }
.erp-nav button[disabled] { opacity: .4; cursor: not-allowed; }
.erp-nav .nav-sep { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); padding: 12px 10px 4px; font-weight: 700; }

.erp-main { flex: 1; padding: 24px; overflow: auto; min-width: 0; }
@media (max-width: 760px) {
  .erp-body { flex-direction: column; }
  .erp-nav { width: 100%; display: flex; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--c-line); -webkit-overflow-scrolling: touch; }
  .erp-nav .nav-sep { display: none; }
  .erp-nav button { width: auto; white-space: nowrap; flex: 0 0 auto; }
  .erp-main { padding: 16px; }
}
/* Barra superior en móvil: fluye a dos filas y no se sale por la derecha */
@media (max-width: 560px) {
  .erp-top { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .erp-top .co { min-width: 0; }
  .erp-top .co span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .erp-top .co small { display: none; }
  .erp-top .right { width: 100%; justify-content: space-between; gap: 6px; }
  .role-switch button { padding: .3em .5em; font-size: .76rem; }
  .btn-reset { font-size: .74rem; padding: .4em .55em; }
}

/* Encabezado de página */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 1.4rem; }
.page-head p { margin: 2px 0 0; color: var(--c-muted); font-size: .9rem; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 22px; }
@media (max-width: 900px){ .kpis { grid-template-columns: repeat(2,1fr); } }
.kpi { background: #fff; border: 1px solid var(--c-line); border-radius: 12px; padding: 16px; }
.kpi .lbl { font-size: .76rem; color: var(--c-muted); font-weight: 600; }
.kpi .val { font-size: 1.6rem; font-weight: 800; color: var(--c-ink); line-height: 1.1; margin-top: 4px; }
.kpi .sub { font-size: .76rem; margin-top: 4px; }
.up { color: var(--c-ok); } .down { color: var(--c-danger); }

/* Tarjetas de panel */
.panel { background: #fff; border: 1px solid var(--c-line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 1.05rem; }

/* Tablas */
table.erp { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.erp th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); padding: 8px 10px; border-bottom: 2px solid var(--c-line); }
table.erp td { padding: 11px 10px; border-bottom: 1px solid var(--c-line); color: var(--c-ink-soft); }
table.erp tr:last-child td { border-bottom: 0; }
table.erp tr:hover td { background: #fafbfd; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Pills de estado */
.pill { display: inline-flex; align-items: center; gap: .4em; font-size: .76rem; font-weight: 700; padding: .25em .7em; border-radius: 999px; }
.pill.ok { background: var(--c-ok-bg); color: var(--c-ok); }
.pill.warn { background: #fff4e0; color: var(--c-accent-d); }
.pill.bad { background: var(--c-danger-bg); color: var(--c-danger); }
.pill.info { background: var(--c-primary-l); color: var(--c-primary-d); }

/* Formularios */
.form-row { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
@media (max-width: 620px){ .form-row { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: .8rem; font-weight: 650; color: var(--c-ink); }
.field input, .field select, .field textarea {
  font-family: inherit; font-size: .92rem; padding: .6em .7em; border: 1.5px solid var(--c-line);
  border-radius: 8px; background: #fff; color: var(--c-ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--c-primary); }
.field .hint { font-size: .74rem; color: var(--c-muted); }
.field .err { font-size: .76rem; color: var(--c-danger); display: none; }
.field.invalid .err { display: block; }
.field.invalid input, .field.invalid textarea { border-color: var(--c-danger); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--c-ink); color: #fff; padding: .8em 1.2em; border-radius: 10px; font-size: .9rem;
  font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Editor web mini */
.web-editor { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
@media (max-width: 760px){ .web-editor { grid-template-columns: 1fr; } }
.we-controls .field { margin-bottom: 14px; }
.we-preview { border: 1px solid var(--c-line); border-radius: 12px; overflow: hidden; background: #fff; }
.we-preview .we-hero { padding: 40px 26px; text-align: center; background: linear-gradient(135deg,#5B2EFF,#3a1f9e); color: #fff; }
.we-preview .we-hero h1 { color: #fff; font-size: 1.8rem; margin-bottom: .3em; }
.we-preview .we-hero p { color: #e7e0ff; margin: 0; }
.we-preview .we-cta { display: inline-block; margin-top: 16px; background: #fff; color: #5B2EFF; font-weight: 700; padding: .6em 1.2em; border-radius: 8px; }
.we-preview .we-body { padding: 24px 26px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 7px; cursor: pointer; border: 2px solid transparent; }
.swatch.sel { border-color: var(--c-ink); }

.muted { color: var(--c-muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display:flex; justify-content: space-between; align-items: center; gap: 10px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 14px; } .mt-3 { margin-top: 20px; } .mb-0 { margin-bottom: 0; }
.note { background: var(--c-primary-l); border-radius: 10px; padding: 12px 14px; font-size: .86rem; color: var(--c-ink-soft); margin-top: 4px; }
.note b { color: var(--c-ink); }
.empty-cta { text-align: center; padding: 40px 24px; }
.empty-cta h3 { margin-bottom: 8px; }
.empty-cta p { max-width: 46ch; margin: 0 auto 14px; }

/* Tablas con scroll propio en móvil (la página NO se desborda) */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-wrap table.erp { min-width: 520px; }

/* Campana de notificaciones */
.btn-bell { position: relative; background: rgba(255,255,255,.16); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.btn-bell:hover { background: rgba(255,255,255,.28); }
.bell-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #ff5a4d; display: none; border: 1.5px solid var(--c-primary); }
.notif-list .notif.unread b { color: var(--c-primary-d); }
.notif-list .notif.unread::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c-primary); display: inline-block; margin-right: 8px; vertical-align: middle; }

/* Toggle de vista (tarjetas / lista) */
.vtoggle { display: inline-flex; background: #eef0f4; border-radius: 8px; padding: 3px; }
.vtoggle button { border: 0; background: transparent; font-family: inherit; font-weight: 600; font-size: .82rem; padding: .35em .8em; border-radius: 6px; cursor: pointer; color: var(--c-ink-soft); }
.vtoggle button.active { background: #fff; color: var(--c-primary-d); box-shadow: var(--shadow-sm); }

/* Banderas en tarjeta de proyecto */
.pcard-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.flag { font-size: .72rem; font-weight: 700; padding: .2em .6em; border-radius: 999px; }
.flag.ok { background: var(--c-ok-bg); color: var(--c-ok); }
.flag.warn { background: #fff4e0; color: var(--c-accent-d); }
.flag.bad { background: var(--c-danger-bg); color: var(--c-danger); }

/* Avatar grande (persona) */
.av-big { width: 46px; height: 46px; border-radius: 12px; background: var(--c-primary-l); color: var(--c-primary-d); display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; flex: 0 0 auto; }

/* Calendario */
.cal-title { font-family: var(--font-head,inherit); font-size: 1.2rem; font-weight: 700; text-transform: capitalize; margin-bottom: 10px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.cal-legend .lg { font-size: .76rem; color: var(--c-ink-soft); display: inline-flex; align-items: center; gap: .4em; }
.cal-legend .lg::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--ec,#999); }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: .72rem; font-weight: 700; color: var(--c-muted); text-transform: uppercase; padding: 4px 0; }
.cal-cell { min-height: 84px; background: #fff; border: 1px solid var(--c-line); border-radius: 8px; padding: 4px; overflow: hidden; }
.cal-cell.out { background: transparent; border: 0; }
.cal-cell.wknd { background: #f7f8fa; }
.cal-num { font-size: .76rem; font-weight: 700; color: var(--c-ink-soft); margin-bottom: 2px; }
.cal-ev { font-size: .66rem; font-weight: 600; color: #fff; background: var(--ec,#888); border-radius: 4px; padding: 1px 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: .66rem; font-weight: 700; color: var(--c-muted); }

/* Vehículos */
.veh-info { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.veh-info > div { font-size: .86rem; color: var(--c-ink-soft); }
.veh-res .rowline { padding: 7px 0; }

/* Chat */
.chatwrap { display: grid; grid-template-columns: 200px 1fr; gap: 12px; }
@media (max-width: 720px){ .chatwrap { grid-template-columns: 1fr; } }
.chat-side { padding: 10px; }
.chat-canal { padding: .5em .7em; border-radius: 8px; font-size: .9rem; font-weight: 600; color: var(--c-ink-soft); cursor: pointer; display: flex; gap: .4em; }
.chat-canal:hover { background: var(--c-bg); }
.chat-canal.active { background: var(--c-primary-l); color: var(--c-primary-d); }
.chat-canal .ch-hash { color: var(--c-muted); }
.chat-main { display: flex; flex-direction: column; min-height: 420px; }
.chat-head { border-bottom: 1px solid var(--c-line); padding-bottom: 10px; margin-bottom: 10px; }
.chat-msgs { flex: 1; overflow-y: auto; }
.chat-msg { margin-bottom: 12px; max-width: 80%; }
.chat-msg.mine { margin-left: auto; text-align: right; }
.chat-de { font-size: .76rem; color: var(--c-ink-soft); font-weight: 600; margin-bottom: 2px; }
.chat-bubble { display: inline-block; background: #f4f6f9; border-radius: 12px; padding: 8px 12px; font-size: .9rem; text-align: left; }
.chat-msg.mine .chat-bubble { background: var(--c-primary-l); color: var(--c-primary-d); }
.chat-input { display: flex; gap: 8px; margin-top: 10px; border-top: 1px solid var(--c-line); padding-top: 10px; }
.chat-input input { flex: 1; font-family: inherit; padding: .6em .7em; border: 1.5px solid var(--c-line); border-radius: 8px; }
.nfc-box { margin-top: 14px; border-top: 1px solid var(--c-line); padding-top: 12px; }

/* Kanban: etiquetas y badges */
.kc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.kc-tag { font-size: .64rem; font-weight: 700; color: #fff; background: var(--tc,#888); border-radius: 4px; padding: 1px 6px; }
.kc-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.kc-badge { font-size: .68rem; font-weight: 700; background: #eef0f4; color: var(--c-ink-soft); border-radius: 6px; padding: 1px 6px; }
.kc-badge.bad { background: var(--c-danger-bg); color: var(--c-danger); }
.kc-badge.ok { background: var(--c-ok-bg); color: var(--c-ok); }

/* Auditoría */
.audit .rowline { padding: 8px 0; align-items: flex-start; }

/* CAE / PRL */
.cae-cli { cursor: default; }
.cae-cli:hover { border-color: var(--c-line); box-shadow: none; }
.cae-pend { list-style: none; margin: 4px 0 0; padding: 0; }
.cae-pend li, .cae-avisos li { font-size: .84rem; color: var(--c-ink-soft); padding: 4px 0; display: flex; align-items: center; gap: .5em; flex-wrap: wrap; }
.cae-avisos { list-style: none; margin: 8px 0 0; padding: 0; }
.cae-ok-line { font-size: .84rem; color: var(--c-ink-soft); display: flex; align-items: center; gap: .5em; margin-top: 6px; }
.cae-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: #bbb; }
.cae-dot.ok { background: var(--c-ok); } .cae-dot.warn { background: var(--c-accent-d,#f0a500); } .cae-dot.bad { background: var(--c-danger); }
.cae-paquete { margin-top: 4px; }

.cae-emp-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px 16px; }
@media (max-width: 620px){ .cae-emp-grid { grid-template-columns: 1fr; } }
.cae-emp-doc { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--c-line); }

.cae-filtros { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cae-filtros select { font-family: inherit; font-size: .88rem; padding: .5em .7em; border: 1.5px solid var(--c-line); border-radius: 8px; background: #fff; color: var(--c-ink); }

.cae-matrix th, .cae-matrix td { white-space: nowrap; }
.cae-cell { display: inline-block; font-size: .72rem; font-weight: 700; padding: .2em .6em; border-radius: 6px; background: #eef0f4; color: var(--c-muted); }
.cae-cell.ok { background: var(--c-ok-bg); color: var(--c-ok); }
.cae-cell.warn { background: #fff4e0; color: var(--c-accent-d); }
.cae-cell.bad { background: var(--c-danger-bg); color: var(--c-danger); }
.cae-cell.na { background: #eef0f4; color: var(--c-muted); }
.cae-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.cae-plat-meta { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 12px 0; }
@media (max-width: 620px){ .cae-plat-meta { grid-template-columns: 1fr; } }
.cae-plat-meta > div { font-size: .88rem; color: var(--c-ink-soft); }
