/* =========================================================
   ÁREA DE LA EMPRESA · menú lateral, Inicio, Clientes y Agenda
   Igual en todos los nichos: usa los colores de styles.css (--cell…)
   ========================================================= */
:root { --menu-w: 236px; --acento: var(--sun, var(--acc, #F2B705)) }

/* ---------- menú lateral ---------- */
.menu-btn { display: none }
@media (min-width: 900px) {
  body.con-menu { padding-left: var(--menu-w) }
  body.con-menu .top { position: fixed; inset: 0 auto 0 0; width: var(--menu-w); flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 22px; padding: 20px 14px; overflow-y: auto; z-index: 20 }
  body.con-menu .top .brand { padding: 0 6px }
  body.con-menu .nav { flex-direction: column; flex-wrap: nowrap; gap: 2px }
  body.con-menu .wrap { min-height: 100vh }
}
body.con-menu .nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; white-space: nowrap }
body.con-menu .nav a svg { width: 18px; height: 18px; flex: none; opacity: .9 }
body.con-menu .nav a .badge { margin-left: auto }
body.con-menu .nav-sep { display: block; height: 1px; background: rgba(255, 255, 255, .15); margin: 8px 6px }
@media (max-width: 899px) {
  body.con-menu .top { flex-wrap: wrap; position: sticky; top: 0; z-index: 20 }
  body.con-menu .menu-btn { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; background: rgba(255, 255, 255, .14); color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; font: inherit; font-size: .9rem; cursor: pointer }
  body.con-menu .menu-btn svg { width: 18px; height: 18px }
  body.con-menu .nav { display: none; width: 100%; flex-direction: column; gap: 2px; padding-top: 8px }
  body.con-menu .top.abierto .nav { display: flex }
}
@media print { body.con-menu { padding-left: 0 } }

/* ---------- piezas comunes de las páginas nuevas ---------- */
.area h1 { margin-bottom: 4px }
.area-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 20px }
.area-head .lead { margin: 0 }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; margin-bottom: 22px }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; min-width: 0 }
.kcard b { font-size: 1.6rem; font-stretch: 115%; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere }
.kcard span { font-size: .85rem; color: var(--mute) }
.kcard.alerta b { color: var(--warn) }
a.kcard:hover { border-color: var(--cell) }
.cols2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start }
@media (max-width: 1100px) { .cols2 { grid-template-columns: 1fr } }
.box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-width: 0 }
.box h2 { font-size: 1.05rem; margin: 0 0 12px; font-stretch: 112%; display: flex; justify-content: space-between; align-items: center; gap: 8px }
.box h2 small { font-weight: 400; color: var(--mute); font-size: .82rem; font-stretch: 100% }
.vacio { color: var(--mute); font-size: .9rem; padding: 10px 0 }

/* filas de tareas / acciones */
.fila { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line) }
.fila:last-child { border-bottom: 0 }
.fila .ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--cell-soft); color: var(--cell); flex: none }
.fila .ico svg { width: 17px; height: 17px }
.fila .ico.warn { background: color-mix(in srgb, var(--warn) 14%, #fff); color: var(--warn) }
.fila .ico.ok { background: color-mix(in srgb, var(--ok) 14%, #fff); color: var(--ok) }
.fila .txt { min-width: 0 }
.fila .txt b { display: block; font-size: .93rem; overflow-wrap: anywhere }
.fila .txt small { display: block; color: var(--mute); font-size: .8rem }
.fila .acc { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end }
.fila.hecha .txt b { text-decoration: line-through; color: var(--mute) }
.chk { width: 22px; height: 22px; accent-color: var(--ok); cursor: pointer }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--cell-soft); color: var(--cell); vertical-align: 1px }
.tag.warn { background: color-mix(in srgb, var(--warn) 14%, #fff); color: var(--warn) }
.tag.ok { background: color-mix(in srgb, var(--ok) 14%, #fff); color: var(--ok) }
.tag.mute { background: #EEF1F5; color: var(--mute) }

/* actividad reciente */
.act { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .88rem }
.act:last-child { border-bottom: 0 }
.act i { width: 9px; height: 9px; border-radius: 50%; background: var(--cell); margin-top: 6px; flex: none }
.act i.ok { background: var(--ok) } .act i.warn { background: var(--warn) } .act i.sun { background: var(--acento) }
.act small { display: block; color: var(--mute); font-size: .78rem }

/* ---------- clientes ---------- */
.buscar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px }
.buscar input[type=search] { flex: 1 1 260px; width: auto }
.crm-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start }
.crm-layout.con-ficha { grid-template-columns: minmax(0, 1fr) minmax(320px, 420px) }
@media (max-width: 1100px) { .crm-layout.con-ficha { grid-template-columns: 1fr } }
.list tr.sel td { background: var(--cell-soft) }
.list tbody tr { cursor: pointer }
.ficha { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto }
@media (max-width: 1100px) { .ficha { position: static; max-height: none; overflow: visible } }
.ficha-h { display: flex; gap: 12px; align-items: center; margin-bottom: 12px }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--cell); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; flex: none }
.ficha-h b { font-size: 1.15rem; display: block; font-stretch: 110% }
.ficha-acc { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px }
.datos { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .88rem; margin-bottom: 14px }
.datos span { color: var(--mute) }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px }
.mini div { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: .75rem; color: var(--mute) }
.mini b { display: block; font-size: 1rem; color: var(--ink); font-variant-numeric: tabular-nums }
.timeline { border-left: 2px solid var(--line); margin: 6px 0 0 6px; padding-left: 14px; display: flex; flex-direction: column; gap: 12px }
.tl { position: relative; font-size: .86rem }
.tl::before { content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--cell); border: 2px solid #fff }
.tl.ok::before { background: var(--ok) } .tl.warn::before { background: var(--warn) } .tl.sun::before { background: var(--acento) } .tl.mute::before { background: var(--mute) }
.tl small { display: block; color: var(--mute); font-size: .76rem }
.tl a { color: var(--cell); font-weight: 600 }
.form-nota { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px }
.form-nota .r { display: flex; gap: 8px; flex-wrap: wrap }
.form-nota select, .form-nota input, .form-nota textarea { width: auto; flex: 1 1 140px }
.form-nota textarea { min-height: 64px; width: 100%; resize: vertical; font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px }

/* ---------- agenda ---------- */
.agenda-g { margin-bottom: 16px }
.agenda-g h2 .n { font-weight: 700; color: var(--mute); font-size: .85rem }
.agenda-g.atrasadas h2 { color: var(--warn) }
.nueva-t { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) auto auto auto; gap: 8px; align-items: end }
.nueva-t label { margin: 0 0 4px }
@media (max-width: 900px) { .nueva-t { grid-template-columns: 1fr 1fr } .nueva-t .btn { grid-column: 1 / -1; justify-content: center } }
.area input[type=date], .area input[type=search] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit }
.area .list { min-width: 640px }
.crm-layout.con-ficha .list { min-width: 0 }
.crm-layout.con-ficha .list th:nth-child(2), .crm-layout.con-ficha .list td:nth-child(2), .crm-layout.con-ficha .list th:nth-child(6), .crm-layout.con-ficha .list td:nth-child(6) { display: none }
.ficha-h .tag { margin-top: 3px }
.fila .txt a, .tl a { color: var(--cell); font-weight: 600; text-decoration: none }
.fila .txt a:hover, .tl a:hover { text-decoration: underline }
