/* Instala360 · estilos */
:root {
  --bg: #f4f6fb; --card: #fff; --ink: #0f1b33; --muted: #64748b; --line: #e3e8f2; --brand: #0b3d91; --brand-2: #1f6feb; --accent: #14b8a6;
  --ok: #16a34a; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7; --err: #dc2626; --err-bg: #fee2e2; --gris-bg: #eef2f7;
  --side: #0b1f4d; --side-ink: #c7d2fe; --r: 12px; --sh: 0 1px 2px rgba(15, 27, 51, .06), 0 4px 16px rgba(15, 27, 51, .05);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root:not([data-theme="light"]) { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0b1220; --card: #111a2e; --ink: #e5ecf7; --muted: #94a3b8; --line: #1f2b45; --gris-bg: #1a2540; --ok-bg: #0f2e1d; --warn-bg: #33270b; --err-bg: #3a1414; --side: #070e20; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0b1220; --card: #111a2e; --ink: #e5ecf7; --muted: #94a3b8; --line: #1f2b45; --gris-bg: #1a2540; --ok-bg: #0f2e1d; --warn-bg: #33270b; --err-bg: #3a1414; --side: #070e20; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; } h1 { font-size: 22px; } h3 { font-size: 15px; } h4 { font-size: 13px; margin-top: 1em; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); min-height: 36px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand-2) 40%, transparent); border-color: var(--brand-2); }
input.err, select.err { border-color: var(--err); background: var(--err-bg); }
input[type=checkbox] { width: auto; min-height: 0; }
textarea { resize: vertical; }
code { font-size: 11px; background: var(--gris-bg); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
.muted { color: var(--muted); } .neg { color: var(--err); } .pos { color: var(--ok); } .r { text-align: right; } .center { text-align: center; justify-content: center; } .nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; } .hint { color: var(--muted); font-size: 12.5px; } .sub { color: var(--muted); margin: 0; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* Botones */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; cursor: pointer; white-space: nowrap; font-weight: 500; min-height: 36px; color: var(--ink); text-decoration: none !important; }
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.primary:hover { background: var(--brand); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--err); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; min-height: 28px; }
.btn.big { padding: 12px 20px; font-size: 16px; min-height: 48px; border-radius: 12px; }
.btn.block { width: 100%; justify-content: center; margin-top: 10px; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 4px 7px; border-radius: 6px; font-size: 15px; color: var(--muted); }
.icon-btn:hover { background: var(--gris-bg); color: var(--ink); }
.seg { display: inline-flex; gap: 2px; }

/* Estructura */
#app { display: flex; min-height: 100vh; }
#side { width: 248px; background: var(--side); color: var(--side-ink); position: fixed; inset: 0 auto 0 0; overflow-y: auto; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 10px; color: #fff; font-size: 19px; }
.brand em { font-style: normal; color: var(--accent); }
.logo-i { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand-2), var(--accent)); display: grid; place-items: center; font-weight: 800; color: #fff; }
.brand.big { font-size: 28px; justify-content: center; color: var(--ink); } .brand.big .logo-i { width: 44px; height: 44px; font-size: 22px; }
#side nav { padding: 6px 10px 20px; flex: 1; }
.nav-g { margin-top: 10px; } .nav-g small { display: block; padding: 6px 10px; text-transform: uppercase; font-size: 10.5px; letter-spacing: .08em; opacity: .55; }
.nav-g a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--side-ink); font-size: 13.5px; text-decoration: none; }
.nav-g a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-g a.on { background: rgba(31, 111, 235, .35); color: #fff; }
.ic { width: 20px; text-align: center; }
.side-foot { padding: 12px 18px; opacity: .6; font-size: 11px; }
#wrap { flex: 1; margin-left: 248px; min-width: 0; display: flex; flex-direction: column; }
#top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
#top .menu { display: none; font-size: 20px; }
.gsearch { position: relative; flex: 1; max-width: 520px; }
#gs-r { position: absolute; top: 42px; left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sh); max-height: 60vh; overflow: auto; }
#gs-r:empty { display: none; }
#gs-r a { display: block; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
#gs-r a small { display: inline-block; min-width: 84px; color: var(--muted); }
#gs-r p { padding: 10px; margin: 0; }
.bell { position: relative; margin-left: auto; font-size: 18px; }
#bell-n { position: absolute; top: -2px; right: -2px; background: var(--err); color: #fff; font-size: 10px; border-radius: 10px; padding: 1px 5px; font-weight: 700; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 10px; }
.user-btn:hover { background: var(--gris-bg); }
.un { display: flex; flex-direction: column; text-align: left; font-size: 13px; line-height: 1.2; } .un small { color: var(--muted); }
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 700; margin-right: 2px; flex: none; }
#main { padding: 22px 24px 60px; max-width: 1500px; width: 100%; }
#tabbar { display: none; }

/* Cabecera de página */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-head .actions input[type=month] { width: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Tarjetas y rejillas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh); margin-bottom: 16px; min-width: 0; overflow-x: auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; } .card-head h3 { margin: 0; }
.card.alert { border-color: var(--warn); background: var(--warn-bg); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } .grid2 > .card { margin-bottom: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; } .grid3 > .card { margin-bottom: 0; }
.grid2 + .grid2, .grid2 + .card, .card + .grid2 { margin-top: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis.small { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--sh); display: flex; flex-direction: column; gap: 2px; border-top: 3px solid var(--brand-2); }
.kpi span { color: var(--muted); font-size: 12px; } .kpi strong { font-size: 20px; letter-spacing: -.01em; } .kpi small { color: var(--muted); font-size: 11.5px; }
.kpi.ok { border-top-color: var(--ok); } .kpi.warn { border-top-color: #f59e0b; } .kpi.err { border-top-color: var(--err); }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; } .dl dt { color: var(--muted); } .dl dd { margin: 0; }

/* Insignias */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--gris-bg); color: var(--muted); white-space: nowrap; text-transform: capitalize; }
.badge.ok, .badge.aceptado, .badge.cobrada, .badge.finalizada, .badge.operativo, .badge.resuelta, .badge.aprobada, .badge.ganado, .badge.recibido, .badge.terminada, .badge.cerrada, .badge.verificada, .badge.facturado, .badge.entrada, .badge.pagado { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .badge.enviado, .badge.visto, .badge.parcial, .badge.pausada, .badge.solicitada, .badge.en_proceso, .badge.alta, .badge.pendiente, .badge.negociacion, .badge.en_reparacion, .badge.pendiente_envio { background: var(--warn-bg); color: var(--warn); }
.badge.err, .badge.rechazado, .badge.vencida, .badge.urgente, .badge.averiado, .badge.cancelada, .badge.perdido, .badge.rechazada, .badge.abierta, .badge.consumo, .badge.salida, .badge.caducado, .badge.baja_medica { background: var(--err-bg); color: var(--err); }
.badge.en_curso, .badge.planificada, .badge.emitida, .badge.presupuestado, .badge.admin { background: color-mix(in srgb, var(--brand-2) 15%, transparent); color: var(--brand-2); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* Tablas */
.tbl-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.tbl-tools .search { max-width: 280px; } .tbl-tools select { width: auto; } .count { margin-left: auto; font-size: 12px; }
.tbl-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.card .tbl-wrap { border: 0; border-radius: 0; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--gris-bg); cursor: pointer; user-select: none; white-space: nowrap; position: sticky; top: 0; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: color-mix(in srgb, var(--brand-2) 5%, transparent); }
.tbl tfoot td { font-weight: 600; background: var(--gris-bg); }
.tbl tr.tot td { border-top: 2px solid var(--ink); }
.card .tbl td, .card .tbl th { padding: 7px 8px; }
.tbl tr:last-child td { border-bottom: 0; }

/* Líneas de documento */
.lines td { padding: 5px 6px; vertical-align: top; } .lines input, .lines select, .lines textarea { padding: 5px 7px; min-height: 32px; }
.lines textarea { min-height: 32px; } .lines tr.cap td { background: var(--gris-bg); } .lines tr.cap input { font-weight: 700; background: transparent; border: 0; }
.w-ref { width: 90px; } .w-num { width: 84px; text-align: right; } .w-pct { width: 64px; text-align: right; } .w-ud { width: 56px; }
.doc-totals { display: flex; justify-content: space-between; gap: 20px; padding: 14px 4px 0; flex-wrap: wrap; }
.tot { min-width: 300px; display: grid; gap: 6px; } .tot > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tot .grand { font-size: 19px; border-top: 2px solid var(--ink); padding-top: 8px; }
.margen-box { display: grid; grid-template-columns: auto auto; gap: 4px 14px; align-content: start; background: var(--ok-bg); padding: 12px 16px; border-radius: 10px; color: var(--ok); }
.margen-box.neg { background: var(--err-bg); color: var(--err); }
.firma-box { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--gris-bg); } .firma-box.ok { background: var(--ok-bg); color: var(--ok); }
.firma-img { max-width: 260px; max-height: 110px; background: #fff; border-radius: 6px; margin-top: 6px; display: block; }
.traza { margin-top: 12px; font-size: 13px; } .traza span { color: var(--muted); }
.vf { display: flex; gap: 14px; align-items: center; margin-top: 14px; padding: 12px; border: 1px dashed var(--brand-2); border-radius: 10px; }
.vf.pend { border-color: var(--line); color: var(--muted); display: block; } .qr { width: 96px; height: 96px; flex: none; background: #fff; padding: 2px; }
.cobros { margin-top: 14px; }

/* Formularios */
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; }
.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; } .f > span { color: var(--muted); font-weight: 500; } .f small { color: var(--muted); font-size: 11.5px; }
.f.wide { grid-column: 1 / -1; } .f.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.chips-sel { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.chip-opt { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 20px; font-size: 12.5px; cursor: pointer; margin: 3px 3px 3px 0; }
.chip-opt:has(input:checked) { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 10%, transparent); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; } .switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 22px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); } .switch input:checked + span::before { transform: translateX(18px); }
.chk, .t-chk { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
canvas.sig { width: 100%; height: 140px; border: 1px dashed var(--muted); border-radius: 10px; background: #fff; touch-action: none; } canvas.sig.big { height: 220px; }

/* Modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(8, 15, 35, .5); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--card); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { width: min(900px, 100%); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); } .modal header h3 { margin: 0; }
.modal-body { padding: 16px 18px; overflow-y: auto; } .modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.opts { display: grid; gap: 8px; } .opt { text-align: left; padding: 12px 14px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.opt:hover { border-color: var(--brand-2); } .opt small { color: var(--muted); }
@keyframes fade { from { opacity: 0; } }

/* Toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 10px; box-shadow: var(--sh); max-width: 380px; transition: .4s; border-left: 4px solid var(--ok); }
.toast.err { border-left-color: var(--err); } .toast.warn { border-left-color: #f59e0b; } .toast.out { opacity: 0; transform: translateY(10px); }

/* Vacío, listas */
.empty { text-align: center; padding: 26px 10px; color: var(--muted); } .empty-ico { font-size: 26px; opacity: .5; }
ul.plain { list-style: none; padding: 0; margin: 0; } ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.alert-list ul { list-style: none; padding: 0; margin: 0; } .alert-list li { padding: 7px 8px; border-left: 3px solid var(--line); margin-bottom: 5px; background: var(--gris-bg); border-radius: 0 6px 6px 0; font-size: 13px; }
.alert-list li.err { border-left-color: var(--err); } .alert-list li.warn { border-left-color: #f59e0b; } .alert-list li.ok { border-left-color: var(--ok); }
.act li { font-size: 12.5px; } .act small { color: var(--muted); display: block; }
.notifs { list-style: none; padding: 0; margin: 0; } .notifs li { padding: 10px; border-bottom: 1px solid var(--line); } .notifs li.nueva { background: color-mix(in srgb, var(--brand-2) 7%, transparent); font-weight: 500; } .notifs small { color: var(--muted); margin-right: 10px; }
.estado-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { border: 0; background: transparent; padding: 9px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); white-space: nowrap; font-weight: 500; }
.tab.on { color: var(--brand-2); border-bottom-color: var(--brand-2); }
.bar { height: 7px; background: var(--gris-bg); border-radius: 6px; overflow: hidden; min-width: 70px; } .bar i { display: block; height: 100%; background: var(--brand-2); }
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; } .fotos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; } .fotos figure { margin: 0; } .fotos figcaption { font-size: 10.5px; color: var(--muted); }
.files { display: grid; gap: 6px; } .file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; } .file small { color: var(--muted); margin-left: auto; }
.row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.logo-prev { max-height: 70px; margin: 8px 0; } .fichar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .fichar > div { flex: 1; } .fichar h3 { margin: 0; } .fichar p { margin: 0; }

/* Gráficos */
.chart { width: 100%; height: 150px; display: block; color: var(--brand); } .chart rect { fill: var(--brand-2); } .chart rect.neg { fill: var(--err); } .chart rect.ok { fill: var(--ok); } .chart circle { fill: var(--brand); }
.chart-l { display: grid; gap: 4px; text-align: center; font-size: 11px; color: var(--muted); } .chart-l b { display: block; color: var(--ink); font-size: 11.5px; }
.hbars { display: grid; gap: 8px; } .hb { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .hb div { background: var(--gris-bg); height: 10px; border-radius: 6px; overflow: hidden; } .hb i { display: block; height: 100%; background: var(--brand-2); } .hb i.neg { background: var(--err); }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.kcol { background: var(--gris-bg); border-radius: var(--r); padding: 10px; min-height: 300px; } .kcol.over { outline: 2px dashed var(--brand-2); }
.kcol header { font-weight: 700; margin-bottom: 10px; display: flex; flex-direction: column; } .kcol header small { font-weight: 400; color: var(--muted); }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; cursor: grab; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--sh); }
.kcard > div { display: flex; justify-content: space-between; align-items: center; } .kcard small { color: var(--muted); } .kactions { margin-top: 4px; }

/* Agenda */
.agenda-layout { display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: start; }
.ag-side { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; margin: 0; }
.agenda { border-collapse: collapse; width: 100%; min-width: 900px; table-layout: fixed; }
.agenda th, .agenda td { border: 1px solid var(--line); padding: 6px; vertical-align: top; }
.agenda thead th { background: var(--gris-bg); font-size: 12px; text-transform: capitalize; } .agenda th.hoy { background: color-mix(in srgb, var(--brand-2) 18%, transparent); }
.agenda tbody th { width: 150px; text-align: left; font-size: 13px; } .agenda tbody th small { display: block; color: var(--muted); font-weight: 400; }
.ag-cell { height: 96px; background: var(--card); } .ag-cell.hoy { background: color-mix(in srgb, var(--brand-2) 4%, var(--card)); } .ag-cell.over { background: color-mix(in srgb, var(--brand-2) 15%, transparent); }
.ag-cell.aus { background: repeating-linear-gradient(45deg, var(--gris-bg) 0 6px, var(--card) 6px 12px); } .aus-l { color: var(--muted); font-size: 11px; }
.ag-ot { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand-2); border-radius: 6px; padding: 4px 6px; margin-bottom: 4px; font-size: 12px; cursor: grab; line-height: 1.25; box-shadow: var(--sh); }
.ag-ot small { display: block; color: var(--muted); font-size: 11px; } .ag-ot.p-urgente { box-shadow: inset 0 0 0 1px var(--err); } .ag-ot.finalizada, .ag-ot.facturada { opacity: .55; } .ag-ot.en_curso { background: var(--ok-bg); }
.ag-side .ag-ot { margin-bottom: 8px; } .ag-side .ag-ot .btn { margin-top: 4px; }
.carga { height: 4px; background: var(--gris-bg); border-radius: 3px; margin-top: 4px; } .carga i { display: block; height: 100%; background: var(--ok); border-radius: 3px; } .carga i.over { background: var(--err); }

/* Gantt */
.gantt-wrap { overflow-x: auto; } .gantt { min-width: calc(220px + var(--days) * var(--dw)); }
.g-head, .g-row { display: grid; grid-template-columns: 220px 1fr; border-bottom: 1px solid var(--line); }
.g-name { padding: 8px; font-size: 13px; border-right: 1px solid var(--line); } .g-name small { display: block; color: var(--muted); }
.g-head .g-days { display: grid; grid-template-columns: repeat(var(--days), var(--dw)); font-size: 10.5px; text-align: center; color: var(--muted); }
.g-head .g-days span { padding: 8px 0; } .g-head .g-days span.we { background: var(--gris-bg); }
.g-row .g-days { position: relative; height: 44px; background: repeating-linear-gradient(90deg, transparent 0 calc(var(--dw) - 1px), var(--line) calc(var(--dw) - 1px) var(--dw)); }
.g-bar { position: absolute; top: 10px; height: 24px; background: color-mix(in srgb, var(--brand-2) 30%, transparent); border-radius: 6px; overflow: hidden; cursor: grab; border: 1px solid var(--brand-2); }
.g-bar i { position: absolute; inset: 0 auto 0 0; background: var(--brand-2); } .g-bar span { position: relative; font-size: 11px; color: #fff; padding: 0 6px; line-height: 22px; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.g-bar.late { border-color: var(--err); background: var(--err-bg); } .g-bar.late i { background: var(--err); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--err); z-index: 1; }

/* Calendario del equipo */
.cal-team { border-collapse: collapse; width: 100%; font-size: 11px; } .cal-team th, .cal-team td { border: 1px solid var(--line); padding: 3px; text-align: center; min-width: 22px; }
.cal-team tbody th { text-align: left; white-space: nowrap; padding-right: 8px; } .cal-team th.we { background: var(--gris-bg); }
.cal-team td.aus, .lg { background: #60a5fa; } .cal-team td.baja_medica, .lg.baja_medica { background: #f87171; } .cal-team td.asuntos_propios, .cal-team td.permiso, .cal-team td.formacion, .cal-team td.otro, .lg.asuntos_propios { background: #fbbf24; }
.cal-team td.solicitada { background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .6) 0 3px, transparent 3px 6px); }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; margin: 0 4px 0 10px; }

/* Mapa */
.map { height: 64vh; border-radius: 10px; } .mk span { display: block; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }

/* Acceso */
body.login-mode #app { display: block; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% 0%, #1f6feb33, transparent), radial-gradient(900px 500px at 100% 100%, #14b8a633, transparent), var(--bg); }
.login-card { background: var(--card); border-radius: 20px; padding: 32px; width: min(720px, 100%); box-shadow: 0 20px 60px rgba(15, 27, 51, .12); text-align: center; }
.login-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.lu { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; cursor: pointer; }
.login-form { text-align: left; max-width: 360px; margin: 18px auto; display: grid; gap: 12px; }
.lu:hover { border-color: var(--brand-2); transform: translateY(-1px); } .lu .av { width: 44px; height: 44px; font-size: 15px; } .lu small { color: var(--muted); }

/* Portal del cliente */
body.portal #app { display: block; } body.portal #main { margin: 0 auto; max-width: 820px; }
.portal-box header { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.portal-box .logo { max-height: 60px; } .portal-box .actions { margin: 20px 0; }

/* App del técnico */
.tec { max-width: 640px; margin: 0 auto; }
.tec h3 { margin: 20px 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.t-fichar { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--sh); }
.t-fichar > div { flex: 1; display: flex; flex-direction: column; } .t-fichar small { color: var(--muted); text-transform: capitalize; } .t-fichar.on { border-color: var(--ok); background: var(--ok-bg); }
.t-off { margin-top: 10px; padding: 10px; background: var(--warn-bg); color: var(--warn); border-radius: 10px; font-size: 13px; }
.t-card { display: flex; justify-content: space-between; gap: 10px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--brand-2); border-radius: 14px; padding: 14px; margin-bottom: 10px; color: var(--ink); text-decoration: none !important; box-shadow: var(--sh); }
.t-card > div:first-child { display: flex; flex-direction: column; min-width: 0; } .t-card small { color: var(--muted); }
.t-card.p-urgente, .t-head.p-urgente { border-left-color: var(--err); } .t-card.p-alta, .t-head.p-alta { border-left-color: #f59e0b; }
.t-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; } .t-meta span { font-weight: 700; font-size: 16px; }
.t-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 20px; }
.t-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 8px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; font-size: 24px; cursor: pointer; color: var(--ink); text-decoration: none !important; }
.t-tile span { font-size: 13px; font-weight: 600; }
.t-back { display: inline-block; margin-bottom: 10px; font-weight: 600; }
.t-head { background: var(--card); border-radius: 16px; padding: 16px; border-left: 6px solid var(--brand-2); box-shadow: var(--sh); } .t-head h2 { margin: 6px 0; font-size: 20px; } .t-head small { color: var(--muted); }
.t-cli { background: var(--card); border-radius: 16px; padding: 14px 16px; margin-top: 10px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--sh); } .t-cli span { color: var(--muted); }
.t-acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; } .t-acts .btn { justify-content: center; min-height: 46px; padding: 6px; gap: 4px; min-width: 0; font-size: 13.5px; }
.t-sec { background: var(--card); border-radius: 16px; padding: 14px 16px; margin-top: 10px; box-shadow: var(--sh); } .t-sec h4 { margin-top: 0; } .t-sec p { margin: 4px 0; }
.t-h { display: flex; justify-content: space-between; align-items: center; } .t-h h4 { margin: 0; }
.t-main { display: flex; gap: 10px; align-items: center; margin-top: 12px; } .t-main .btn { flex: 1; justify-content: center; min-height: 58px; font-size: 17px; }
.t-timer { flex: 1; background: var(--ok-bg); color: var(--ok); border-radius: 12px; padding: 12px; text-align: center; font-size: 22px; font-variant-numeric: tabular-nums; }
.t-chk { font-size: 15px; padding: 10px 0; } .t-chk input { width: 22px; height: 22px; }

/* Impresión */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; } #print-area { display: block; } body { background: #fff; color: #111; font-size: 11.5px; }
  .doc-print { padding: 0; } .pb { page-break-after: always; }
  @page { margin: 14mm; }
}
.doc-print header { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #0b3d91; padding-bottom: 12px; margin-bottom: 14px; }
.doc-print .logo { max-height: 64px; } .doc-print h1 { font-size: 22px; color: #0b3d91; margin: 0 0 4px; } .doc-print .doc-id { text-align: right; }
.doc-print .dest { border: 1px solid #ccd; border-radius: 6px; padding: 10px; margin-bottom: 12px; width: 60%; }
.doc-print table { width: 100%; border-collapse: collapse; margin: 8px 0; } .doc-print th, .doc-print td { border-bottom: 1px solid #dde; padding: 5px 6px; text-align: left; vertical-align: top; }
.doc-print th { background: #eef2fb; font-size: 10.5px; } .doc-print .r { text-align: right; } .doc-print tr.cap td { font-weight: 700; background: #f5f7fc; }
.doc-print .kv th { width: 34%; } .doc-print .tots { margin-left: auto; width: 45%; display: grid; gap: 3px; } .doc-print .tots > div { display: flex; justify-content: space-between; }
.doc-print .tots .grand { font-size: 15px; border-top: 2px solid #111; padding-top: 5px; } .doc-print .cond { font-size: 10.5px; color: #333; margin-top: 12px; white-space: pre-wrap; }
.doc-print .firma-print img { max-height: 80px; } .firma-hueco { height: 70px; border-bottom: 1px solid #999; width: 260px; margin-top: 6px; }
.doc-print .firmas { display: flex; justify-content: space-between; margin-top: 30px; } .doc-print footer { margin-top: 24px; font-size: 9.5px; color: #777; text-align: center; border-top: 1px solid #ddd; padding-top: 6px; }
.doc-print .vf-print { display: flex; gap: 10px; align-items: center; margin-top: 14px; } .fotos-print { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; } .fotos-print img { width: 100%; height: 120px; object-fit: cover; }

/* Responsive */
@media (max-width: 1100px) { .grid3 { grid-template-columns: 1fr 1fr; } .agenda-layout { grid-template-columns: 1fr; } .ag-side { position: static; max-height: none; } }
@media (max-width: 760px) {
  #side { transform: translateX(-100%); transition: .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .4); } body.nav-open #side { transform: none; }
  #wrap { margin-left: 0; } #top { padding: 8px 12px; gap: 8px; } #top .menu { display: block; } .un { display: none; }
  #main { padding: 14px 16px 90px; } .grid2, .grid3 { grid-template-columns: 1fr; } .page-head h1 { font-size: 19px; }
  .kpis { grid-template-columns: repeat(2, 1fr); } .kpi strong { font-size: 17px; } .dl { grid-template-columns: 1fr; } .dl dt { margin-top: 6px; }
  .tbl-wrap .tbl thead { display: none; } .tbl-wrap .tbl tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .tbl-wrap .tbl td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 4px 12px; text-align: right; } .tbl-wrap .tbl td::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; }
  .tbl-wrap .tbl.lines td, .tbl-wrap .tbl.lines tr { display: table-cell; } .tbl-wrap .tbl.lines tr { display: table-row; } .tbl-wrap .tbl.lines thead { display: table-header-group; }
  .tot { min-width: 0; width: 100%; } .modal-wrap { padding: 0; place-items: end stretch; } .modal { border-radius: 18px 18px 0 0; max-height: 92vh; width: 100%; }
  body.tec-mode #tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; inset: auto 0 0 0; background: var(--card); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 40; }
  #tabbar a { display: flex; flex-direction: column; align-items: center; font-size: 20px; color: var(--muted); text-decoration: none; } #tabbar a span { font-size: 11px; } #tabbar a.on { color: var(--brand-2); }
  .gsearch { max-width: none; }
}
