/* =========================================================
   Multiservicios BIM — Panel de administración
   ========================================================= */
:root {
  --navy: #0a1c3a;
  --navy-2: #102a52;
  --bg: #f2f5fa;
  --surface: #ffffff;
  --line: #dde4ef;
  --line-2: #c9d3e3;
  --ink: #0e1b33;
  --muted: #5b6b85;
  --blue: #1e6bff;
  --cyan: #2bd3ff;
  --amber: #ffb31a;
  --amber-ink: #3a2700;
  --ok: #138a52;
  --warn: #b86e00;
  --err: #c63a3a;
  --radius: 14px;
  --font-d: "Chakra Petch", system-ui, sans-serif;
  --font: "Figtree", system-ui, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 400 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font: 600 14px/1.1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--amber); color: var(--amber-ink); }
.btn-primary:hover { background: #ffa600; box-shadow: 0 6px 16px -6px rgba(255, 166, 0, .7); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-soft { background: #e8f0ff; color: #1450c8; }
.btn-soft:hover { background: #d9e6ff; }
.btn-wa { background: #25d366; color: #fff; }
.btn-wa:hover { background: #1fbd5a; }
.btn-danger-ghost { background: transparent; color: var(--err); border-color: #f0c9c9; }
.btn-danger-ghost:hover { background: #fdf0f0; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 18px; font-size: 15px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.icon-btn:hover { background: #fdecec; color: var(--err); }
.link { font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- Formularios ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: #34425c; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink); font: 400 15px/1.35 var(--font);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30, 107, 255, .15); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); }
.check input[type="number"] { width: 76px; padding: 6px 8px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.stack { display: grid; gap: 16px; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(60% 50% at 80% 10%, rgba(30, 107, 255, .35), transparent 70%),
    radial-gradient(40% 40% at 10% 100%, rgba(255, 179, 26, .12), transparent 70%),
    var(--navy);
}
.login-card {
  width: min(420px, 100%); background: #fff; border-radius: 20px; padding: 36px 32px 28px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55); text-align: center;
}
.login-logo { width: 104px; height: auto; margin: -80px auto 12px; filter: drop-shadow(0 10px 24px rgba(30, 107, 255, .45)); }
.login-card h1 { font: 700 24px/1.2 var(--font-d); }
.login-card > p { margin: 8px 0 22px; }
.login-card form { text-align: left; }
.login-back { display: inline-block; margin-top: 18px; font-size: 14px; color: var(--muted); }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 20px 16px; background: var(--navy); color: #c9d6ec; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 600 19px var(--font-d); padding: 0 6px; }
.side-brand img { width: 40px; height: auto; }
.side-brand b { color: var(--cyan); }
.side-new { display: grid; gap: 8px; }
.side .btn-soft { background: rgba(255, 255, 255, .08); color: #e8f0ff; }
.side .btn-soft:hover { background: rgba(255, 255, 255, .14); }
.side-nav, .side-foot { display: grid; gap: 2px; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .1); }
.side-nav a, .side-foot a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #c9d6ec; text-decoration: none; font-weight: 500;
}
.side-nav a:hover, .side-foot a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a[aria-current="page"], .side-foot a[aria-current="page"] { background: rgba(43, 211, 255, .12); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.side-nav a[aria-current="page"] .ic { color: var(--cyan); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 22px 32px 6px; }
.topbar h1 { font: 700 26px/1.2 var(--font-d); }
.menu-btn { display: none; }
.content { padding: 18px 32px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; }

.flash { margin: 12px 32px 0; padding: 12px 16px; border-radius: 10px; font-weight: 500; }
.content .flash, .card .flash, .login-card .flash { margin: 0 0 14px; }
.flash-ok { background: #e6f6ee; color: #0c6b3e; }
.flash-err { background: #fdecec; color: #a42a2a; }
.flash-info { background: #e8f0ff; color: #1450c8; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font: 700 17px/1.2 var(--font); }
.card.narrow { max-width: 640px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; padding: 28px 12px; display: grid; gap: 14px; justify-items: center; color: var(--muted); }
.empty p { margin: 0; }
.danger-zone { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-2); }
.content > .danger-zone { border: 0; margin: 0; padding: 0; }

/* ---------- Indicadores ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat {
  display: grid; gap: 4px; padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.stat:hover { border-color: var(--blue); box-shadow: 0 8px 22px -14px rgba(30, 107, 255, .6); }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat strong { font: 700 26px/1.2 var(--font-d); }
.stat-sub { font-size: 13px; color: var(--muted); }
.stat-warn strong { color: var(--warn); }

/* ---------- Tablas ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.search { display: flex; gap: 8px; flex: 1; max-width: 640px; }
.search input { flex: 1; min-width: 0; }
.search select { width: auto; }
.table-wrap { overflow-x: auto; margin: -4px -22px -20px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 22px; text-align: left; border-top: 1px solid var(--line); vertical-align: middle; }
.table thead th { border-top: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); background: #f7f9fc; }
.table tbody tr:hover { background: #f8fbff; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.actions { text-align: right; white-space: nowrap; }
.actions .link + .link { margin-left: 14px; }
.folio { white-space: nowrap; font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; color: var(--ink); text-decoration: none; }
.strong:hover { color: var(--blue); }
.sub { font-size: 13px; color: var(--muted); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: #eef1f6; color: #3e4c66; white-space: nowrap; }
.badge-enviada { background: #e8f0ff; color: #1450c8; }
.badge-aceptada, .badge-pagada { background: #e3f5ec; color: var(--ok); }
.badge-rechazada, .badge-cancelada { background: #fdecec; color: var(--err); }
.badge-pendiente { background: #fff3dc; color: var(--warn); }
.badge-anticipo { background: #fff8e6; color: #8a5d00; }

/* ---------- Editor de documentos ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.doc-main { display: grid; gap: 20px; }
.doc-main .card > .field + .field { margin-top: 14px; }
.sticky { position: sticky; top: 16px; display: grid; gap: 16px; }
.client-info { margin: -4px 0 0; color: var(--muted); font-size: 14px; }
.client-info:empty { display: none; }
.new-client { padding: 16px; border-radius: 12px; background: #f6f8fc; border: 1px dashed var(--line-2); }
.new-client[hidden] { display: none; }

.items { display: grid; gap: 8px; margin-bottom: 14px; }
.items-head, .item-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 120px 110px 120px 34px; gap: 10px; align-items: start; }
.items-head { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 2px; }
.item-row textarea { min-height: 42px; overflow: hidden; }
.cost-cell input, .cost-h { background: #fff8e6; }
.cost-h { background: none; color: #a06a00; }
.cost-cell input { border-style: dashed; border-color: #e3c675; }
.cost-hint { margin: 10px 0 12px; color: #a06a00; }
.totals.internal { background: #fff8e6; border-radius: 10px; padding: 8px 12px; margin-top: 10px; }
.i-amount { padding: 11px 2px; font-weight: 600; font-variant-numeric: tabular-nums; }

.doc-side .form-grid:not(.pay) { grid-template-columns: 1fr; }
.folio-box { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--navy); color: #fff; }
.folio-box dt { font-size: 13px; color: #9fb3d6; }
.folio-box dd { margin: 2px 0 0; font: 700 24px/1.1 var(--font-d); }
.folio-box small { font: 500 12px var(--font); color: #9fb3d6; }
.totals { margin: 0; display: grid; gap: 6px; }
.totals div { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-weight: 600; }
.totals .grand { padding-top: 10px; border-top: 1px solid var(--line); }
.totals .grand dt { color: var(--ink); font-weight: 700; }
.totals .grand dd { font: 700 24px/1 var(--font-d); }
.totals .due dd { color: var(--warn); font-size: 18px; }
.pay { padding-top: 14px; border-top: 1px solid var(--line); }
.side-actions { display: grid; gap: 8px; }
.side-links { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.side-links a { font-weight: 600; text-decoration: none; }
.side-links a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(6, 17, 39, .5); }
  .menu-btn {
    display: grid; gap: 4px; place-content: center; width: 42px; height: 42px; border-radius: 10px;
    border: 1px solid var(--line-2); background: #fff; cursor: pointer;
  }
  .menu-btn span { width: 18px; height: 2px; background: var(--ink); }
  .topbar { padding: 16px; }
  .topbar h1 { font-size: 21px; }
  .content { padding: 12px 16px 40px; }
  .flash { margin: 8px 16px 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
  .table-wrap { margin: -4px -16px -18px; }
  .table th, .table td { padding: 11px 16px; }
  .items-head { display: none; }
  .item-row {
    grid-template-columns: 70px 1fr 110px 34px; grid-template-areas: "q d d x" "p p a a" "c c c c";
    padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  }
  .item-row > label:nth-child(1) { grid-area: q; }
  .item-row > label:nth-child(2) { grid-area: d; }
  .item-row > label:nth-child(3) { grid-area: p; }
  .item-row > .i-amount { grid-area: a; }
  .item-row > .i-del { grid-area: x; }
  .item-row > .cost-cell { grid-area: c; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .search { flex-wrap: wrap; }
}

/* ---------- Usuarios, expediente y archivos ---------- */
.badge-role-admin { background: #e8f0ff; color: #1450c8; }
.badge-role-vendedor { background: #fff3dc; color: #8a5d00; }
.side-foot .who { display: grid; line-height: 1.2; }
.side-foot .who small { font-size: 12px; color: #8fa5c9; font-weight: 500; }
.roles-help ul, .plain-list { margin: 10px 0 0; padding-left: 18px; color: #34425c; display: grid; gap: 6px; }
.plain-list { list-style: none; padding: 0; gap: 10px; }
.plain-list li { padding-left: 16px; position: relative; }
.plain-list li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 2px; background: var(--amber); transform: rotate(45deg); }
.due { color: var(--warn); }

.client-head { display: grid; gap: 18px; }
.client-id { display: flex; align-items: center; gap: 14px; }
.client-id h2 { font: 700 22px/1.2 var(--font-d); }
.avatar { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--navy); color: var(--cyan); font: 700 22px var(--font-d); flex: none; }
.client-data { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 24px; }
.client-data dt { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.client-data dd { margin: 2px 0 0; font-weight: 500; }
.client-data .wide { grid-column: 1 / -1; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.attach-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.attach-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.attach-list form { margin: 0; }
.attach-ic { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 9px; background: #eef3ff; color: #1450c8; font: 700 11px var(--font); }
.attach-main { flex: 1; min-width: 0; }
.attach-main a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.upload-form input[type="file"] { width: auto; flex: 1 1 240px; padding: 8px; background: #f7f9fc; }
.card-head .link { font-size: 14px; }

@media (max-width: 860px) { .stats-3 { grid-template-columns: 1fr; } }
.totals.internal[hidden]{display:none}

/* ---------- Financiamientos ---------- */
.kv-list { margin: 0; display: grid; gap: 8px; }
.kv-list > div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.kv-list dt { color: var(--muted); font-weight: 600; font-size: 14px; }
.kv-list dd { margin: 0; text-align: right; }
.plan-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.plan-fs[disabled] { opacity: .6; }
.mode-pick { display: grid; gap: 8px; margin: 14px 0; }
.plan-sum .grand dd { font-size: 22px; }
.plan-eff { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.plan-warn { margin: 8px 0 0; padding: 9px 12px; border-radius: 10px; background: #fff3dc; color: #8a5d00; font-size: 13.5px; font-weight: 600; }
.mini-h { font: 700 13px/1.2 var(--font); margin: 16px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--line); }
.mini-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); }
.mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table tbody tr { cursor: pointer; }
.mini-table tbody tr:hover { background: #f2f7ff; }
.mini-table tbody tr.on { background: #e8f0ff; font-weight: 700; }
.plan-head { align-items: flex-start; flex-wrap: wrap; }
.plan-table td { vertical-align: top; }
.pp-vencido td { background: #fff6f6; }
.badge-pp-pagado, .badge-plan-liquidado { background: #e3f5ec; color: var(--ok); }
.badge-pp-vencido { background: #fdecec; color: var(--err); }
.badge-pp-parcial { background: #fff8e6; color: #8a5d00; }
.badge-pp-pendiente { background: #eef1f6; color: #3e4c66; }
.badge-plan-activo { background: #e8f0ff; color: #1450c8; }
.badge-plan-recuperado { background: #fff3dc; color: var(--warn); }
.badge-plan-cancelado { background: #fdecec; color: var(--err); }
.pay-pop { display: inline-block; position: relative; }
.pay-pop summary { cursor: pointer; list-style: none; }
.pay-pop summary::-webkit-details-marker { display: none; }
.pay-pop[open] .pay-form { position: absolute; right: 0; z-index: 20; margin-top: 6px; width: 290px; padding: 14px; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 16px 40px -14px rgba(10, 28, 58, .4); display: grid; gap: 10px; text-align: left; }
.actions .link.danger, button.link.danger { color: var(--err); background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; margin-left: 14px; padding: 0; }
.inline-form { display: flex; gap: 10px; align-items: end; }
.tabs { display: flex; gap: 4px; padding: 4px; background: #e8edf5; border-radius: 12px; }
.tabs a { padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--muted); }
.tabs a[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(10, 28, 58, .15); }
@media (max-width: 860px) {
  .plan-table { min-width: 640px; }
  .pay-pop[open] .pay-form { right: auto; left: 0; }
}

.mode-pick .check { display: flex; align-items: center; justify-content: flex-start; gap: 10px; text-align: left; }
.mode-pick .check input { width: auto; flex: none; margin: 0; }
.mode-pick .check span { text-align: left; }
.pay-pop summary.link { color: var(--blue); }

/* ---------- Pagos y cobranza ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.chip { padding: 7px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; }
.chip small { color: var(--muted); }
.pp-void td { opacity: .55; text-decoration: line-through; }
.pp-void td .sub, .pp-void td a { text-decoration: none; }
.pay-pop > summary.btn { list-style: none; display: inline-flex; cursor: pointer; }
.pay-box { max-width: 216mm; margin: 0 auto 12px; padding: 12px 14px; background: #f1fbf5; border: 1px solid #cfe9da; border-radius: 12px; }
.pay-box-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.pay-box .spacer { flex: 1; }
.pay-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.pay-list li.pp-void { opacity: .55; text-decoration: line-through; }
.pay-box .pay-pop[open] .pay-form { right: 0; }

/* ---- gastos, catálogo, agenda ---- */
.badge-exp-pagado { background: #e3f5ec; color: var(--ok); }
.badge-exp-parcial { background: #fff8e6; color: #8a5d00; }
.badge-exp-pendiente { background: #eef1f6; color: #3e4c66; }
.badge-exp-vencido { background: #fdecec; color: var(--err); }
.badge-appt-programada { background: #eef1f6; color: #3e4c66; }
.badge-appt-confirmada { background: #e8f0ff; color: #1450c8; }
.badge-appt-realizada { background: #e3f5ec; color: var(--ok); }
.badge-appt-cancelada { background: #fdecec; color: var(--err); }
.item-row { position: relative; }
.suggest { position: absolute; left: 0; top: 100%; z-index: 30; width: min(560px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 34px -12px rgba(10, 28, 58, .35); overflow: hidden; }
.suggest button { display: flex; justify-content: space-between; gap: 14px; width: 100%; text-align: left; padding: 10px 14px; border: 0; background: #fff; cursor: pointer; font: inherit; }
.suggest button + button { border-top: 1px solid var(--line); }
.suggest button:hover { background: #f1f6ff; }
.suggest span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.day-h { font: 700 15px/1.2 var(--font); margin: 20px 0 8px; color: #34425c; text-transform: capitalize; }
.day-h:first-child { margin-top: 0; }
.appt { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.appt-time { min-width: 56px; font: 700 15px/1.2 var(--font-d); color: var(--blue); }
.appt-time small { font: 600 12px var(--font); color: var(--muted); }
.appt-body { flex: 1; min-width: 0; }
.appt-act { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.appt-act .link { background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; padding: 0; color: var(--blue); }
.appt-off { opacity: .55; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-d { min-height: 92px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 3px; background: #fff; overflow: hidden; }
.cal-empty { background: transparent; border-color: transparent; }
.cal-today { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.cal-n { font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; }
.cal-ev { font-size: 11.5px; line-height: 1.25; padding: 2px 5px; border-radius: 6px; background: #e8f0ff; color: #1450c8; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-realizada { background: #e3f5ec; color: var(--ok); }
.ev-cancelada { background: #fdecec; color: var(--err); text-decoration: line-through; }
@media (max-width: 720px) { .cal-d { min-height: 64px; } .cal-ev { font-size: 10px; } .appt { flex-wrap: wrap; } .appt-act { justify-content: flex-start; } }

/* ---- módulos 4-7 ---- */
.badge-war-vigente, .badge-mnt-ok { background: #e3f5ec; color: var(--ok); }
.badge-war-vencida, .badge-mnt-vencido { background: #fdecec; color: var(--err); }
.badge-mnt-proximo { background: #fff3dc; color: var(--warn); }
.badge-inv-borrador { background: #eef1f6; color: #3e4c66; }
.badge-inv-timbrada { background: #e3f5ec; color: var(--ok); }
.badge-inv-cancelada { background: #fdecec; color: var(--err); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { padding: 9px 12px; border-radius: 10px; font-size: 14px; }
.checklist .good { background: #e8f7ef; color: #146c43; }
.checklist .bad { background: #fff3dc; color: #7a4f00; }
.json { background: #0f1b33; color: #cfe0ff; padding: 14px; border-radius: 12px; overflow: auto; font-size: 12.5px; max-height: 420px; }
.fu-hist td { border-top: 0 !important; padding-top: 0 !important; background: #fbfcfe; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figcaption { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; }
.gal-pdf { display: grid; place-items: center; aspect-ratio: 4 / 3; background: #eef1f6; font-weight: 700; color: var(--muted); }

.badge-role-tecnico{background:#e6f7f1;color:#0f6b4d}
.badge-lead-nuevo{background:#fff3cd;color:#7a5a00}.badge-lead-contactado{background:#e1ecff;color:#1d4a9a}.badge-lead-cotizado{background:#ece3ff;color:#5b2fb0}.badge-lead-ganado{background:#dcf5e3;color:#14702f}.badge-lead-perdido{background:#eee;color:#666}

.gsearch{margin-left:auto}.gsearch input{width:min(280px,42vw);padding:9px 14px;border:1px solid var(--line,#cbd5e1);border-radius:999px;background:#fff;font:inherit;font-size:14px}
.sr-group{margin-top:16px}.sr-item{display:flex;justify-content:space-between;gap:12px;padding:9px 0;border-top:1px solid #8882}.sr-item:first-of-type{border-top:0}
@media (max-width:860px){.topbar{flex-wrap:wrap}.gsearch{flex-basis:100%;margin-left:0}.gsearch input{width:100%}}
@media (max-width:860px){.stats.stats-3{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:560px){.stats.stats-3{grid-template-columns:minmax(0,1fr)}}

.acc-item{border-top:1px solid #8882;padding:9px 0}.acc-item:first-of-type{border-top:0}
.acc-row{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;align-items:flex-start}
.acc-edit{display:none;margin-top:8px;padding:12px;border:1px solid var(--line-2);border-radius:12px}
.acc-toggle:checked~.acc-edit{display:block}

.ev-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-top:10px}
.ev-btn{display:inline-flex;align-items:center;gap:8px;cursor:pointer;min-height:48px;padding:0 18px;font-size:1rem}
.ev-btn svg{width:22px;height:22px}
@media (max-width:640px){.ev-btn{flex:1 1 100%;justify-content:center}}
#workForm .day-h{text-transform:none}
/* Portal del cliente (reportes) */
.portal-page{background:var(--bg,#f1f5fb);min-height:100vh}
.portal{max-width:680px;margin:0 auto;padding:16px 16px 0}
.portal-head{display:flex;align-items:center;gap:12px;padding:6px 2px 14px}
.portal .card{margin-bottom:16px}
.portal h1{font:700 22px/1.2 var(--font-d);margin:0 0 6px}
.tk-item{border-top:1px solid #8882;padding:14px 0}.tk-item:first-of-type{border-top:0}
.tk-top{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.tk-desc{margin:8px 0}
.tk-reply{background:#e8f3ff;border-left:3px solid #1e6bff;border-radius:8px;padding:10px 12px;margin-top:8px;font-size:.95rem;color:#0a1c3a}
