:root {
  /* Colores de Golden Tropics (goldentropicsgroup.com): verde #235B4E, verde noche #10312B, beige #DFD9D0 y el lima del aguacate del logo */
  --bg: #f6f4f0; --panel: #ffffff; --text: #1c2421; --muted: #646d69; --line: #e5e0d8;
  --brand: #235B4E; --brand-2: #3f7f6e; --brand-soft: #e2ece8; --accent: #b8860b;
  --brand-dark: #10312B; --brand-hover: #1a4a3f; --lima: #B5D050; --beige: #DFD9D0;
  --titulos: "Bodoni Moda", Georgia, serif;
  --amber: #fff1c7; --amber-text: #7a5600; --red: #b3261e; --red-soft: #fde8e6; --blue: #1f5fa8;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
a { color: var(--brand); }

.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--brand-dark); color: #fff; display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 2px 8px 16px; }
.brand .logo-marca { width: 170px; height: auto; display: block; }
.brand small { opacity: .8; font-size: 11.5px; line-height: 1.35; letter-spacing: .01em; }
.brand.big { color: var(--muted); align-items: center; text-align: center; padding-bottom: 6px; }
.brand.big .logo-marca { width: 220px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar nav a { color: #e8f0e5; text-decoration: none; padding: 9px 12px; border-radius: 8px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); }
.sidebar nav a.activo { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--lima); }
/* Menú por bloques plegables */
.sidebar nav details.grupo { display: flex; flex-direction: column; }
.sidebar nav details.grupo > summary { list-style: none; cursor: pointer; padding: 10px 12px 6px; font-size: 13px; font-weight: 700; white-space: nowrap;
  color: rgba(255,255,255,.78); display: flex; align-items: center; gap: 6px; border-radius: 8px; user-select: none; }
.sidebar nav details.grupo > summary::-webkit-details-marker { display: none; }
.sidebar nav details.grupo > summary::after { content: '▸'; margin-left: auto; transition: transform .15s; opacity: .8; }
.sidebar nav details.grupo[open] > summary::after { transform: rotate(90deg); }
.sidebar nav details.grupo > summary:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav details.grupo > a { padding-left: 18px; }
.sidebar nav details.grupo + details.grupo { border-top: 1px solid rgba(255,255,255,.08); }
.sidebar nav a small { opacity: .7; font-weight: 400; }
/* La oficina tiene arriba su bloque del dinero */
body[data-rol="oficina"] .sidebar nav details[data-g="dinero"] { order: -1; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.15); padding: 12px 8px 0; }
.sidebar-foot label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; opacity: .9; }
.sidebar-foot select { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.sidebar-foot select option { color: var(--text); }
.badge { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 11px; margin-left: auto; }

main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 23px; margin: 0; flex: 1; font-family: var(--titulos); font-weight: 600; letter-spacing: .005em; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.menu { display: inline-block; font-size: 18px; line-height: 1; }
/* En el ordenador, el botón ☰ oculta el menú de la izquierda para ver la pantalla más ancha */
@media (min-width: 901px) {
  .layout.menu-oculto { grid-template-columns: 1fr; }
  .layout.menu-oculto .sidebar { display: none; }
}
.vista { padding: 24px 28px 60px; }

.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }

input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand-2); }
textarea { min-height: 70px; resize: vertical; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }

.filtros { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: flex-end; }
.filtros label { min-width: 160px; }
.filtros input[type=search] { min-width: 220px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card h3 { margin: 0; font-size: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.card .cuerpo { padding: 14px 16px; }

.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f8faf6; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); position: sticky; top: 0; cursor: pointer; user-select: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.calc { background: #fafbf9; color: #333; }
tbody tr:hover { background: #f6faf4; }
tr.inactiva td { color: #9aa59c; }
tfoot td { font-weight: 700; background: #f3f7f0; }
td.amber { background: var(--amber); color: var(--amber-text); font-weight: 600; }
td.texto { white-space: normal; min-width: 180px; max-width: 320px; }
.cuadrilla-cab { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.cuadrilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; max-height: 220px; overflow: auto; }
.cuadrilla label.check { margin: 0; }
.card h3 > span { display: inline-flex; gap: 6px; margin-left: auto; }
.card.borrador { border: 2px solid var(--amber-text); }
.avisos { background: var(--amber); color: var(--amber-text); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-top: 8px; }
fieldset.deposito { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 4px 0; }
fieldset.deposito legend { font-weight: 700; padding: 0 6px; }
.fila-dep { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.fila-dep label { flex: 1; min-width: 140px; }
.linea-prod { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.linea-prod select { flex: 2; min-width: 200px; }
.linea-prod input[data-cant], .linea-prod input[data-obs] { flex: 1; min-width: 90px; }
.linea-prod .ud { min-width: 22px; color: #666; font-size: 13px; }
.linea-prod.sin-catalogo { background: #fde2e1; border-radius: 8px; padding: 4px 6px; }
.linea-prod .leido { flex-basis: 100%; color: #a12622; }
table.tabla-receta { width: 100%; }
table.tabla-receta td { vertical-align: top; }
label.resaltado { background: var(--amber); border-radius: 8px; padding: 6px 8px; }
b.amber { color: var(--amber-text); background: var(--amber); padding: 0 6px; border-radius: 6px; }
td.texto .recorte { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vacio { padding: 40px; text-align: center; color: var(--muted); }

.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.chip.tg { background: #e3f1fb; color: #1a6fa8; }
.chip.excel { background: #e8f3e8; color: #217346; }
.chip.pend { background: var(--amber); color: var(--amber-text); }
.chip.off { background: #eee; color: #777; }
.chip.aguacate { background: var(--brand-soft); color: var(--brand); }
.chip.citricos { background: #fdebd3; color: #9a4a00; }
.chip.mixta { background: #efe9f8; color: #5a3d8a; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px; }
.kpi small { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
.kpi b { display: block; font-size: 24px; margin-top: 6px; }
.kpi span { color: var(--muted); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 18px; }
.barra { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.barra i { display: block; height: 100%; background: var(--brand-2); }
.lista-simple { list-style: none; margin: 0; padding: 0; }
.lista-simple li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.lista-simple li:last-child { border: 0; }
/* Si los botones no caben al lado (tarjetas estrechas, desplegables), bajan a otra línea en vez de salirse de la tarjeta */
.lista-simple li { flex-wrap: wrap; }
.lista-simple li > div:first-child { flex: 1 1 220px; min-width: 0; }
.lista-simple li > div:last-child { flex-shrink: 0; white-space: nowrap; }
.lista-simple li select { max-width: 100%; }
.lista-simple small { color: var(--muted); }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(760px, 96vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,30,20,.45); }
dialog header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
dialog h2 { margin: 0; font-size: 17px; }
dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 18px 20px; max-height: 65vh; overflow-y: auto; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .calculo { grid-column: 1 / -1; background: var(--brand-soft); border-radius: 8px; padding: 10px 12px; color: var(--brand); font-weight: 500; }
.error { color: var(--red); margin: 0 20px; font-weight: 500; min-height: 1em; }
.check { flex-direction: row; align-items: center; gap: 8px; }
.check input { width: auto; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--text); color: #fff; padding: 10px 18px; border-radius: 8px; transition: transform .25s; z-index: 100; }
.toast.ver { transform: translateX(-50%) translateY(0); }

.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, var(--brand) 0%, var(--brand-dark) 70%); }
.login-card { background: #fff; padding: 32px; border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; width: min(360px, 92vw); }
.login-card .error { margin: 0; }

.ajustes { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.lista-edit textarea { min-height: 150px; font-size: 13px; }
.estado-bot { display: flex; gap: 10px; align-items: center; }
.punto { width: 10px; height: 10px; border-radius: 50%; background: #bbb; display: inline-block; }
.punto.ok { background: #3c9a46; }
.nota { color: var(--muted); font-size: 12px; line-height: 1.5; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.abierta { transform: none; }
  .menu { display: inline-block; }
  .topbar { padding: 12px 16px; }
  .vista { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
.sidebar-foot .quien { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 13px; }
.sidebar-foot .quien .btn { color: #fff; border-color: rgba(255,255,255,.35); }
.sidebar-foot .quien small { display: block; opacity: .75; font-size: 11px; }

/* Lo que cada papel no puede hacer no se enseña (el servidor lo impide igualmente) */
body:not([data-rol="admin"]) .solo-admin { display: none !important; }
/* El almacén solo tiene su pantalla de facturas */
body[data-rol="almacen"] .sidebar nav a:not([data-r="gastos"]):not([data-r="albaranes"]), body[data-rol="almacen"] .sidebar nav h4, body[data-rol="almacen"] #campanaGlobal { display: none !important; }
/* … y sin bloques: sus dos entradas, siempre a la vista (sin títulos de bloque) */
body[data-rol="almacen"] .sidebar nav details.grupo > summary { display: none !important; }
body[data-rol="almacen"] .sidebar nav details.grupo:not([data-g="almacen"]):not([data-g="dinero"]) { display: none !important; }
body[data-rol="almacen"] .sidebar nav details.grupo > a { padding-left: 12px; }
tr.clicable { cursor: pointer; }
details.seccion-oficial { border-bottom: 1px solid rgba(0,0,0,.08); padding: 6px 0; }
details.seccion-oficial summary { cursor: pointer; }
details.seccion-oficial ul { margin: 6px 0 4px 22px; }
tr.clicable:hover td { background: rgba(0, 0, 0, .03); }
body[data-rol="consulta"] .vista .btn.primary, body[data-rol="consulta"] .vista .btn.danger,
body[data-rol="consulta"] #accionesTop .btn.primary, body[data-rol="consulta"] #accionesTop .btn.danger { display: none !important; }
/* La oficina apunta (y borra facturas) solo en Gastos y Comunidad de regantes; en el resto, como «Solo consultar» */
body[data-rol="oficina"]:not([data-vista="gastos"]):not([data-vista="cargar-facturas"]):not([data-vista="regantes"]):not([data-vista="albaranes"]):not([data-vista="servicios"]):not([data-vista="clientes"]):not([data-vista="tarifas-servicio"]) .vista .btn.primary,
body[data-rol="oficina"]:not([data-vista="gastos"]):not([data-vista="cargar-facturas"]):not([data-vista="regantes"]):not([data-vista="albaranes"]):not([data-vista="servicios"]):not([data-vista="clientes"]):not([data-vista="tarifas-servicio"]) #accionesTop .btn.primary,
body[data-rol="oficina"]:not([data-vista="gastos"]):not([data-vista="cargar-facturas"]):not([data-vista="regantes"]):not([data-vista="albaranes"]):not([data-vista="servicios"]):not([data-vista="clientes"]):not([data-vista="tarifas-servicio"]) .vista .btn.danger, body[data-rol="oficina"]:not([data-vista="gastos"]):not([data-vista="cargar-facturas"]):not([data-vista="regantes"]):not([data-vista="albaranes"]):not([data-vista="servicios"]):not([data-vista="clientes"]):not([data-vista="tarifas-servicio"]) #accionesTop .btn.danger { display: none !important; }
/* Empresas y albaranes */
.empresas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.empresa { text-align: left; cursor: pointer; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); font: inherit; color: inherit; }
.empresa:hover, .empresa.on { border-color: var(--brand-2); box-shadow: 0 0 0 2px var(--brand-soft); }
.empresa b { display: block; font-size: 15px; }
.empresa small { color: var(--muted); }
/* Filas que llevan a otra pantalla al pulsarlas, y aviso suave */
tr.clic { cursor: pointer; }
tr.clic:hover td { background: var(--brand-soft); }
.chip.amber { background: var(--amber); color: var(--amber-text); }
/* Gasto por sector y campo */
tr.subtotal td { background: var(--brand-soft); }
b.rojo { color: var(--red); }
/* Fichajes: solo los ven el administrador y la oficina */
body:not([data-rol="admin"]):not([data-rol="oficina"]) .solo-fichajes { display: none !important; }
.chip.rojo { background: var(--red-soft); color: var(--red); }
.aviso-pruebas { background: var(--amber); color: var(--amber-text); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
tr.no-cuenta td { color: #999; text-decoration: line-through; }
tr.no-cuenta td.motivo, tr.no-cuenta td:last-child { text-decoration: none; }
/* Historial de cambios */
ul.historial { list-style: none; margin: 0; padding: 0; }
ul.historial li { border-bottom: 1px solid var(--line); padding: 8px 14px; }
ul.historial .hcab { cursor: pointer; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
ul.historial .hdet { padding: 6px 0 2px 18px; font-size: 13px; display: grid; gap: 4px; }
ul.historial .oculto { display: none; }
.tachado { text-decoration: line-through; color: var(--muted); }
/* Partes repartidos en varias fincas (formulario de la web) */
.tramo-web { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.tramo-web .full { grid-column: 1 / -1; }

/* Riego: leyenda de la gráfica (un color fijo por sector) */
.leyenda-riego { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.leyenda-riego span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda-riego b { color: var(--text, #222); font-variant-numeric: tabular-nums; }
.leyenda-riego i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.leyenda-riego i.linea { height: 2px; width: 16px; background: #0b0b0b; border-radius: 0; }
td .punto { margin-right: 6px; border-radius: 2px; }
details.card > summary { cursor: pointer; padding: 14px 16px; list-style: revert; }

/* ===== Móvil (pantallas de hasta 700 px): todo cabe a lo ancho, tablas como fichas y botones para el dedo ===== */
@media (max-width: 700px) {
  body { font-size: 15px; }
  .vista { padding: 12px 10px 60px; }
  /* Cabecera: el título arriba y los botones debajo, bajando de línea si no caben */
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .topbar h1 { font-size: 18px; min-width: 0; }
  .topbar .acciones { width: 100%; }
  .acciones .btn, .card h3 .btn { white-space: normal; }
  .card h3 { flex-wrap: wrap; gap: 8px; }
  .card h3 > span { flex-wrap: wrap; }
  /* Botones y campos cómodos para el dedo; letra de 16 px en los campos para que el iPhone no haga zoom */
  .btn { min-height: 44px; padding: 8px 14px; }
  .btn.sm { min-height: 40px; padding: 6px 12px; font-size: 14px; }
  .acciones { gap: 8px; }
  input, select, textarea, .lista-edit textarea { font-size: 16px; min-height: 44px; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 20px; height: 20px; }
  .filtros label { min-width: 0; flex: 1 1 140px; }
  .filtros input[type=search] { min-width: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi b { font-size: 20px; }
  img, canvas, svg { max-width: 100%; }
  pre { white-space: pre-wrap; }
  td.texto { min-width: 0; max-width: none; }
  /* Ventanas (formularios) a pantalla casi completa */
  dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: auto 0 0; border-radius: 14px 14px 0 0; }
  .form-grid { padding: 14px; max-height: calc(100dvh - 150px); }
  dialog footer { flex-wrap: wrap; padding: 12px 14px; position: sticky; bottom: 0; background: var(--panel); }
  dialog footer .btn { flex: 1 1 auto; }

  /* Tablas como fichas: cada fila es una tarjeta y cada dato lleva delante el nombre de su columna */
  .tabla-wrap { overflow-x: visible; }
  table.fichas, table.fichas tbody, table.fichas tfoot, table.fichas tr, table.fichas td { display: block; width: 100%; }
  /* Las cabeceras no se ven, pero los lectores de pantalla las siguen leyendo */
  table.fichas thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.fichas [hidden], table.fichas td.ficha-vacia { display: none !important; }
  table.fichas tr { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 10px; padding: 6px 12px; background: var(--panel); }
  .card table.fichas { padding: 10px 10px 0; }
  table.fichas tbody tr:hover { background: var(--panel); }
  table.fichas td { padding: 7px 0; border: 0; border-bottom: 1px dashed var(--line); white-space: normal; text-align: right; overflow-wrap: anywhere; }
  table.fichas td::after { content: ''; display: block; clear: both; }
  table.fichas td:last-child { border-bottom: 0; }
  table.fichas td::before { content: attr(data-label); float: left; max-width: 45%; margin-right: 12px; padding-top: 1px; text-align: left; font-size: 12.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .02em; color: #4a574d; }
  /* Sin nombre de columna (botones, celdas que ocupan toda la fila): a lo ancho */
  table.fichas td[data-label=""] { text-align: left; }
  table.fichas td[data-label=""] .btn { margin: 4px 8px 4px 0; }
  table.fichas td[data-label=""]::before { display: none; }
  table.fichas td:empty { display: none; }
  /* El primer dato hace de título de la ficha */
  table.fichas td:first-child { font-weight: 600; font-size: 15px; }
  table.fichas td > input, table.fichas td > select { max-width: 60%; }
  table.fichas tr.subtotal, table.fichas tfoot tr { background: var(--brand-soft); }
  table.fichas tr.subtotal td, table.fichas tfoot td { background: transparent; }
  /* Los avisos (en ámbar) conservan su fondo para que se vean a pleno sol */
  table.fichas td.amber { background: var(--amber); color: var(--amber-text); margin: 2px -8px; padding: 7px 8px; border-radius: 6px; }
}

/* Riego por etapas: los nombres de las etapas pueden partirse en dos líneas */
table.etapas th { white-space: normal; min-width: 70px; vertical-align: bottom; }
table.etapas td:last-child { white-space: normal; min-width: 150px; }
.barra-tierra { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-top: 4px; min-width: 60px; background: var(--line); }
.barra-tierra i { display: block; height: 100%; }
/* Mapa de sectores (Leaflet) */
.leaflet-tooltip.etiqueta-mapa { background: rgba(0,0,0,.55); color: #fff; border: 0; box-shadow: none; font-weight: 700; font-size: 12px; padding: 1px 5px; }
.leaflet-tooltip.etiqueta-mapa::before { display: none; }
.leyenda-mapa { background: rgba(255,255,255,.92); padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.6; color: #222; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.leyenda-mapa i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.mapa-lejos .leaflet-tooltip.etiqueta-mapa { display: none; }
.barra-dibujo { background: #fff; padding: 8px 10px; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,.35); max-width: 240px; font-size: 13px; color: #222; }
.dibujando .leaflet-overlay-pane path, .dibujando .leaflet-overlay-pane svg { pointer-events: none !important; } .dibujando { cursor: crosshair; }
/* El mapa (Leaflet) trae capas con z-index 400-1000: se encierran en su propia capa para que el menú del móvil y la barra de arriba queden encima */
.leaflet-container { position: relative; z-index: 0; isolation: isolate; }

/* Horas para tratar (Tiempo y heladas): una casilla por hora de 6 a 20, verde = vale, roja = no (el motivo, al pasar el ratón o tocar) */
.ventana-tratar { padding: 8px 0; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.ventana-tratar:last-child { border-bottom: 0; }
.franja-horas { display: flex; gap: 2px; flex-wrap: wrap; }
.franja-horas span { min-width: 22px; text-align: center; font-size: 11px; padding: 2px 0; border-radius: 4px; }
.franja-horas .si { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.franja-horas .no { background: var(--red-soft); color: var(--red); }
.franja-horas .suelta { background: var(--amber); color: var(--amber-text); }

/* Clientes y servicios: solo para el administrador y la oficina */
body:not([data-rol="admin"]):not([data-rol="oficina"]) .sidebar nav details[data-g="clientes"] { display: none; }
/* Cifras de la pantalla Cobrar servicios */
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.grid4 .card { margin: 0; }
.cifra { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.btn:disabled { opacity: .5; cursor: not-allowed; }
