/* =====================================================================
   Absolute Help · Panel privado
   Estilo sobrio de cuadro de mando: superficies planas separadas por
   líneas finas, una sola tipografía (Inter, cifras tabulares) y el cobre
   de la marca reservado para lo activo y la acción principal.
   ===================================================================== */

@font-face { font-family: "Inter"; src: url("../fonts/inter-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-Bold.woff") format("woff"); font-weight: 700 800; font-display: swap; }

:root {
  --ink: #0F2547;          /* azul marino de la marca: texto y menú */
  --ink-2: #12315B;
  --muted: #5E6B7F;        /* texto secundario (contraste AA sobre blanco) */
  --faint: #8A96A8;
  --canvas: #F2F4F7;       /* fondo de la aplicación */
  --panel: #FFFFFF;
  --rule: #DCE2EA;         /* líneas y bordes */
  --rule-soft: #EBEFF4;
  --accent: #E87722;       /* cobre: solo activo y acción principal */
  --accent-dark: #CF6312;
  --data: #2070BD;         /* serie principal de los gráficos */
  --good: #1E7F55;
  --bad: #B3261E;
  --late: #B4570F;
  --warn-bg: #FFF5E8;
  --radius: 6px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-family: var(--font);
  font-feature-settings: "tnum" 1, "cv11" 1;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--data); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.num, .num-inline { text-align: right; font-variant-numeric: tabular-nums; }
.text-urgent { color: var(--bad); font-weight: 600; }
.text-late { color: var(--late); font-weight: 600; }
.mt { margin-top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code.secret { display: inline-block; font-size: 15px; letter-spacing: .08em; background: var(--warn-bg); border: 1px solid #F3D3B0; padding: 6px 9px; border-radius: var(--radius); user-select: all; word-break: break-all; }

/* ---------- Controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); border-radius: var(--radius); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #C3CCD8; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { color: var(--bad); }
.btn-small { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { display: flex; width: 100%; }
.link-button { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; text-align: left; }
.link-button:hover { text-decoration: underline; }
.form { display: grid; gap: 14px; margin: 18px 0; }
.form label, .filters label { display: grid; gap: 5px; font-weight: 600; font-size: 13px; }
input, select { font: inherit; height: 38px; padding: 0 10px; border: 1px solid #CBD3DE; border-radius: var(--radius); background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, .btn:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.code-input { height: 52px; font-size: 26px; letter-spacing: .4em; text-align: center; }

.alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13.5px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert p { margin: 3px 0; }
.alert-error { background: #FCEEEE; border-color: #F0C7C4; color: #8C1D17; }
.alert-info { background: #EEF4FB; border-color: #CFE0F3; color: #18406E; }
.alert-success { background: #ECF7F1; border-color: #BFE3CF; color: #165C3E; }

/* ---------- Acceso ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-content: center; gap: 16px; padding: 24px; background: var(--ink); }
.auth-card { width: min(400px, 92vw); background: var(--panel); border-radius: 10px; padding: 32px 30px 28px; }
.auth-card h1 { font-size: 20px; margin-top: 22px; }
.auth-logo { display: block; width: 116px; height: auto; margin: 0 auto 6px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; }
.auth-foot { color: rgba(255, 255, 255, .6); text-align: center; font-size: 12.5px; }
.auth-card .muted { margin-top: 6px; }
.steps { padding-left: 18px; display: grid; gap: 8px; margin: 16px 0; }

/* ---------- Estructura ---------- */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: rgba(255, 255, 255, .78); display: flex; flex-direction: column; padding: 20px 12px 16px; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand strong { display: block; color: #fff; font-size: 14px; }
.brand small { display: block; color: rgba(255, 255, 255, .55); font-size: 12px; }
.brand-logo { width: 38px; height: auto; display: block; }
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; color: rgba(255, 255, 255, .78); padding: 8px 10px; border-radius: var(--radius); font-weight: 500; font-size: 13.5px; }
.sidebar nav a svg { width: 17px; height: 17px; flex: none; opacity: .75; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: rgba(255, 255, 255, .09); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.sidebar nav a.active svg { opacity: 1; color: var(--accent); }
.nav-section { margin: 14px 0 4px; padding: 0 10px; font-size: 11.5px; color: rgba(255, 255, 255, .45); }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .12); padding: 14px 8px 0; display: grid; gap: 6px; font-size: 13px; }
.sidebar-user strong { color: #fff; }
.sidebar-user small { display: block; color: rgba(255, 255, 255, .55); }
.sidebar-user a, .sidebar-user .link-button { color: rgba(255, 255, 255, .72); font-size: 12.5px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 28px; height: 60px; background: var(--panel); border-bottom: 1px solid var(--rule); }
.topbar h1 { font-size: 16px; flex: 1; }
.menu-toggle { display: none; background: none; border: 1px solid var(--rule); border-radius: var(--radius); width: 36px; height: 36px; font-size: 17px; cursor: pointer; }
.content { padding: 24px 28px 40px; display: grid; gap: 20px; align-content: start; max-width: 1480px; width: 100%; }

.card { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.card.narrow { max-width: 540px; }
.card > h2 { margin-bottom: 12px; }
.card-head, .section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head { margin-bottom: 10px; }
.pill { font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-wide-left { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }

.sync-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.sync-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.sync-ok::before { background: var(--good); }
.sync-warn::before { background: var(--accent); }

/* ---------- Cifras clave: una sola franja dividida por líneas ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { display: grid; align-content: start; gap: 4px; padding: 18px 20px 16px; color: var(--ink); text-decoration: none; border-left: 1px solid var(--rule); min-width: 0; }
.kpi:first-child { border-left: 0; }
a.kpi:hover { background: #FAFBFD; text-decoration: none; }
.kpi span { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi strong { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12.5px; color: var(--muted); }
.kpi-urgent strong { color: var(--bad); }
.kpi-late strong { color: var(--late); }
.kpi-soon strong { color: var(--faint); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; }
.delta-up { color: var(--good); }
.delta-down { color: var(--bad); }
.delta-flat { color: var(--muted); font-weight: 500; }
.delta small { font-weight: 400; color: var(--muted); }

/* ---------- Tablas y listas ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 8px 8px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.table th.num { text-align: right; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFBFD; }
.table.compact td { padding: 8px; }
.row-off td { opacity: .5; }
.row-alert td { background: #FDF5F4; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.actions form { margin: 0; }
progress { width: 84px; height: 6px; vertical-align: middle; appearance: none; border: 0; border-radius: 3px; background: var(--rule-soft); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--rule-soft); border-radius: 3px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
progress.bar-blue::-webkit-progress-value { background: var(--data); }
progress.bar-blue::-moz-progress-bar { background: var(--data); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }
.list li:last-child { border-bottom: 0; }
.list small { display: block; color: var(--muted); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 4px; border: 1px solid var(--rule); color: var(--muted); background: #fff; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-urgent { color: var(--bad); border-color: #F0C7C4; }
.tag-late { color: var(--late); border-color: #F1D2B6; }
.tag-pendiente { color: #8A5A00; border-color: #EBD9AE; }
.tag-en_curso { color: var(--data); border-color: #C8DCF1; }
.tag-cerrada { color: var(--good); border-color: #BFE3CF; }
.tag-cancelada { color: var(--faint); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filters label { min-width: 150px; }
.filters .grow { flex: 1; min-width: 220px; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }
.roles { margin: 18px 0 0; display: grid; gap: 2px; }
.roles dt { font-weight: 600; }
.roles dd { margin: 0 0 8px; color: var(--muted); }

/* ---------- Análisis ---------- */
.hero-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.hero-head h2.display { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.hero-head .muted { margin-top: 4px; }
.period { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.period select, .period input { width: auto; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend span, .donut-legend dt { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.sw-blue { background: #2070BD; }
.sw-copper { background: #E87722; }
.chart { width: 100%; height: auto; display: block; }
.chart .tick { font-size: 11px; fill: #5E6B7F; font-family: var(--font); }
.chart .tick-label { font-size: 12.5px; fill: #0F2547; font-weight: 500; font-family: var(--font); }
.chart .val { font-size: 11px; font-weight: 600; fill: #0F2547; font-family: var(--font); }
.chart .mark:hover path, .chart .mark:hover circle { opacity: .8; }
.chart-note { margin-top: 10px; }
.donut { max-width: 170px; }
.donut .donut-big { font-size: 22px; font-weight: 600; fill: #0F2547; font-family: var(--font); }
.donut .donut-small { font-size: 10px; fill: #5E6B7F; font-family: var(--font); }
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: center; padding: 8px 0 12px; }
.donut-legend { margin: 0; display: grid; gap: 2px; }
.donut-legend dt { color: var(--muted); font-size: 13px; }
.donut-legend dd { margin: 0 0 10px; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.criteria { margin: 14px 0 0; padding-left: 18px; display: grid; gap: 4px; }
details.card summary { cursor: pointer; font-weight: 600; }

/* ---------- Mapa ---------- */
.page-map .content { padding-bottom: 24px; gap: 14px; }
.map-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; }
.map-toolbar label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.map-toolbar select { width: auto; min-width: 200px; }
.map-toolbar label.check { display: flex; align-items: center; gap: 6px; height: 38px; color: var(--ink); font-size: 13px; cursor: pointer; }
.map-toolbar input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.map-key { position: absolute; left: 12px; bottom: 12px; z-index: 5; list-style: none; margin: 0; padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 12px; color: var(--ink); background: rgba(255, 255, 255, .94); border: 1px solid var(--rule); border-radius: var(--radius); }
.map-key li { display: inline-flex; align-items: center; gap: 6px; }
.key { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--rule); }
.key-tec { background: var(--accent); width: 14px; height: 14px; }
.key-pendiente { background: var(--ink-2); }
.key-en_curso { background: var(--data); }
.key-alerta { background: var(--bad); }

.map-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; height: calc(100vh - 160px); min-height: 480px; }
.map { position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--rule); background: #E8EDF2; cursor: grab; touch-action: none; user-select: none; }
.map.dragging { cursor: grabbing; }
/* Callejero en tonos apagados para que destaquen los puntos */
.map-tiles { position: absolute; inset: 0; filter: grayscale(.85) contrast(.92) brightness(1.04); }
.map-tiles img { position: absolute; top: 0; left: 0; width: 256px; height: 256px; will-change: transform; }
.map-route { position: absolute; inset: 0; pointer-events: none; overflow: visible; will-change: transform; }
.route-line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 6 5; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.map-markers { position: absolute; inset: 0; will-change: transform; }
.map.dragging .marker { pointer-events: none; }
.marker { position: absolute; top: 0; left: 0; border: 0; cursor: pointer; padding: 0; font: 700 11px var(--font); color: #fff; display: grid; place-content: center; }
.marker-ord { width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--ink-2); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
.marker-ord.estado-en_curso { background: var(--data); }
.marker-ord.marker-alert { background: var(--bad); }
.marker-ord.marker-num { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
.marker-tec { width: 32px; height: 32px; margin: -16px 0 0 -16px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); z-index: 2; }
.marker-tec.marker-old { background: #B9C2CF; }
.marker:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.map-controls { position: absolute; top: 12px; left: 12px; display: grid; gap: 4px; z-index: 5; }
.map-controls button { width: 32px; height: 32px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; font-size: 16px; cursor: pointer; color: var(--ink); }
.map-attrib { position: absolute; right: 0; bottom: 0; background: rgba(255, 255, 255, .85); font-size: 11px; padding: 1px 6px; z-index: 5; }
.map-popup { position: absolute; top: 0; left: 0; z-index: 10; width: 260px; margin: 0 0 0 -130px; translate: 0 calc(-100% - 22px); background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 8px 24px rgba(15, 37, 71, .18); font-size: 13px; display: grid; gap: 2px; cursor: auto; }
.map-popup .popup-title { font-weight: 600; padding-right: 16px; }
.map-popup.below { translate: 0 22px; }
.map-popup .popup-action { margin-top: 8px; justify-self: start; }
.map-popup-close { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.map-side { overflow-y: auto; padding: 16px; }
.map-side-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.map-side .muted { margin: 2px 0 10px; }
.map-list, ul.map-list { list-style: none; margin: 0; padding: 0; }
.map-list .list-head { font-size: 12px; color: var(--muted); margin: 14px 0 4px; }
.map-list ul, .map-list ol { list-style: none; margin: 0; padding: 0; }
.map-list-item { width: 100%; display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; align-items: center; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--rule-soft); padding: 9px 4px; cursor: pointer; font: inherit; color: var(--ink); }
.map-list-item > strong { grid-column: 2; font-size: 13px; font-weight: 600; }
.map-list-item > small { grid-column: 2; color: var(--muted); font-size: 12px; }
.map-list-item:hover { background: #FAFBFD; }
.map-list-item.is-alert > strong { color: var(--bad); }
.map-list-item .count { grid-column: 3; grid-row: 1 / span 2; min-width: 24px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--rule); border-radius: 10px; padding: 0 6px; }
.map-list-item .stop { grid-column: 1; grid-row: 1 / span 2; width: 24px; height: 24px; border-radius: 50%; background: var(--ink-2); color: #fff; display: grid; place-content: center; font-size: 11px; font-weight: 700; }
.map-list-item.is-alert .stop { background: var(--bad); }


/* ---------- Red de técnicos ---------- */
:root { --st-disponible: #1E7F55; --st-ocupado: #C27C0E; --st-pendiente: #2070BD; --st-nousar: #8A96A8; }
.head-actions { display: flex; gap: 8px; }
.input-btn { display: flex; gap: 6px; }
.input-btn input { flex: 1; }
.map-toolbar .grow { flex: 1; min-width: 220px; }
.map-toolbar input[type=search] { min-width: 0; }
.sector-filter { position: relative; }
.sector-filter > summary { list-style: none; height: 38px; font-weight: 500; }
.sector-filter > summary::-webkit-details-marker { display: none; }
.sector-filter > summary::after { content: "▾"; margin-left: 6px; color: var(--muted); }
.sector-menu { position: absolute; z-index: 20; top: 42px; left: 0; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(15, 37, 71, .14); padding: 8px 12px; display: grid; gap: 2px; min-width: 220px; }
.sector-menu label.check { height: 30px; }
.marker-red { width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); font-size: 10px; letter-spacing: .02em; }
.marker-red.is-selected { width: 36px; height: 36px; margin: -18px 0 0 -18px; box-shadow: 0 0 0 3px var(--ink), 0 2px 8px rgba(0, 0, 0, .35); z-index: 3; }
.est-disponible { background: var(--st-disponible); }
.est-ocupado { background: var(--st-ocupado); }
.est-pendiente-red { background: var(--st-pendiente); }
.est-nousar { background: var(--st-nousar); }
.marker-punto { width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0, 0, 0, .3); z-index: 4; pointer-events: none; }
.radio-trabajo { fill: rgba(32, 112, 189, .08); stroke: var(--data); stroke-width: 1.5; stroke-dasharray: 5 4; }
.key-disponible { background: var(--st-disponible); }
.key-ocupado { background: var(--st-ocupado); }
.key-pendiente-red { background: var(--st-pendiente); }
.key-nousar { background: var(--st-nousar); }
.est-dot { grid-column: 1; grid-row: 1 / span 2; width: 10px; height: 10px; border-radius: 50%; align-self: start; margin-top: 5px; }
.count.is-empty { display: none; }
.map-side .volver { margin-bottom: 12px; }
.ficha-cab { display: flex; gap: 12px; align-items: center; }
.ficha-cab h2 { font-size: 17px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; color: #fff; display: grid; place-content: center; font-weight: 700; flex: none; }
.ficha-estado { margin: 12px 0 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.est-tag-disponible { color: var(--st-disponible); border-color: #BFE3CF; }
.est-tag-ocupado { color: var(--st-ocupado); border-color: #EBD9AE; }
.est-tag-pendiente-red { color: var(--st-pendiente); border-color: #C8DCF1; }
.est-tag-nousar { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 4px; background: var(--canvas); border: 1px solid var(--rule); }
.ficha-tel { margin: 0 0 8px; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ficha-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tarifas { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 13px; }
.tarifas th, .tarifas td { padding: 7px 0; border-top: 1px solid var(--rule-soft); }
.tarifas tr:last-child th, .tarifas tr:last-child td { border-bottom: 1px solid var(--rule-soft); }
.tarifas th { text-align: left; color: var(--muted); font-weight: 400; }
.tarifas td { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.tarifas td.muted { font-weight: 400; }
.ficha-sub { font-size: 13px; margin: 14px 0 4px; }
.ficha-notas { white-space: pre-line; font-size: 13px; }
.estrellas { display: flex; align-items: center; gap: 2px; margin: 4px 0 14px; }
.estrella { border: 0; background: none; font-size: 22px; line-height: 1; color: #D2D9E3; cursor: pointer; padding: 0 2px; }
.estrella.on, .estrellas:hover .estrella { color: #E8A317; }
.estrella:hover ~ .estrella { color: #D2D9E3; }
.estrellas span { margin-left: 8px; }
.ficha-editar { margin-top: 4px; }

.form-card { max-width: 920px; }
.form-grid { grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.form-grid fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; align-content: start; }
.form-grid legend { font-weight: 600; font-size: 14px; margin-bottom: 8px; padding: 0; }
.span-all { grid-column: 1 / -1; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 16px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13.5px; cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); }
textarea { font: inherit; padding: 8px 10px; border: 1px solid #CBD3DE; border-radius: var(--radius); width: 100%; resize: vertical; color: var(--ink); }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-actions { display: flex; gap: 8px; padding-top: 6px; border-top: 1px solid var(--rule-soft); }
.danger-zone { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--rule); }
input[type=file] { height: auto; padding: 8px; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } .head-actions .btn:not(.btn-primary) { display: none; } }

/* ---------- Tablet y móvil ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi { border-top: 1px solid var(--rule); }
  .kpis-4 .kpi:nth-child(-n+2), .kpis:not(.kpis-4) .kpi:nth-child(-n+3) { border-top: 0; }
  .kpis-4 .kpi:nth-child(odd) { border-left: 0; }
  .grid-2, .grid-wide-left { grid-template-columns: 1fr; }
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map { height: 60vh; }
  .map-side { max-height: 50vh; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .menu-toggle { display: inline-block; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px 14px 32px; gap: 16px; }
  .kpis:not(.kpis-4) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis:not(.kpis-4) .kpi { border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
  .kpis:not(.kpis-4) .kpi:nth-child(odd) { border-left: 0; }
  .kpis:not(.kpis-4) .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi { padding: 14px; }
  .kpi strong { font-size: 24px; }
  .chart-scroll { overflow-x: auto; }
  .chart-scroll .chart { min-width: 560px; }
  .period { width: 100%; }
  .period select { flex: 1 1 100%; }
  .period input { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* Iconos de sector */
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ico-marker { width: 15px; height: 15px; stroke: #fff; stroke-width: 2.2; }
.marker-red.is-selected .ico-marker { width: 19px; height: 19px; }
.chip { display: inline-flex; align-items: center; gap: 5px; }
.chip .ico { width: 14px; height: 14px; color: var(--ink-2); }
.list-icos { grid-column: 2; display: flex; gap: 6px; margin: 2px 0 1px; color: var(--ink-2); }
.list-icos .ico { width: 14px; height: 14px; }

/* Colores por sector */
.bg-clima { background: #2A78D6; } .ico.sec-clima { color: #2A78D6; }
.bg-elec { background: #C98500; } .ico.sec-elec { color: #C98500; }
.bg-fonta { background: #0E9AA7; } .ico.sec-fonta { color: #0E9AA7; }
.bg-cerra { background: #6250D6; } .ico.sec-cerra { color: #6250D6; }
.bg-carpi { background: #8B5A2B; } .ico.sec-carpi { color: #8B5A2B; }
.bg-multi { background: #D55181; } .ico.sec-multi { color: #D55181; }
.bg-plagas { background: #008300; } .ico.sec-plagas { color: #008300; }
.bg-puertas { background: #5E6B7D; } .ico.sec-puertas { color: #5E6B7D; }
.bg-pci { background: #E34948; } .ico.sec-pci { color: #E34948; }
.bg-limpi { background: #1BAF7A; } .ico.sec-limpi { color: #1BAF7A; }
.bg-otro { background: #8A96A8; } .ico.sec-otro { color: #8A96A8; }
.bg-nousar { background: #111; }
.ico.ico-marker { color: #fff; }
.marker-red.marca-ocupado::after, .marker-red.marca-pendiente-red::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid #fff; }
.marker-red.marca-ocupado::after { background: #C27C0E; }
.marker-red.marca-pendiente-red::after { background: #8A96A8; }
.marker-red.marca-nousar { opacity: .9; }
.map-key-sectores { display: block; padding: 6px 10px; }
.map-key-sectores > summary { cursor: pointer; font-weight: 600; font-size: 12px; }
.map-key-sectores ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: auto auto; gap: 3px 12px; }
.map-key-sectores li { display: flex; align-items: center; gap: 5px; }
.ico.ico-key { width: 13px; height: 13px; stroke-width: 2.2; }
.key-negro { background: #111; }
.key-ocupado-marca, .key-pendiente-marca { width: 9px; height: 9px; border-radius: 50%; }
.key-ocupado-marca { background: #C27C0E; } .key-pendiente-marca { background: #8A96A8; }
.est-nousar { background: #111; }
.est-tag-nousar { color: #111; border-color: #111; }

.acceso-equipo { display: flex; gap: 24px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.acceso-equipo p { margin: 4px 0 0; max-width: 72ch; color: var(--ink-2); }
@media (max-width: 760px) { .acceso-equipo { flex-direction: column; align-items: flex-start; } }

/* Proveedores al mapa */
.estado-proveedores { list-style: none; margin: 0; padding: 0; }
.estado-proveedores a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.estado-proveedores a:hover { background: #FAFBFD; }
.estado-proveedores li.is-active a { background: var(--canvas); box-shadow: inset 3px 0 0 var(--accent); }
.estado-proveedores strong { font-variant-numeric: tabular-nums; }
