:root {
  --paper: #f5f4f0;
  --card: #ffffff;
  --ink: #141414;
  --ink-2: #55534e;
  --ink-3: #6f6c65;
  --line: #e2e0da;
  --line-2: #cfccc4;
  --gold: #b08a3c;
  --gold-ink: #7a5d22;
  --danger: #b5574c;
  --st-d: #5f9e74;
  --st-a: #c9a54e;
  --st-v: #b5574c;
  --st-b: #8a8a84;
  --r: 10px;
  /* plano */
  --map-ground: #e9e7e1;
  --map-site: #dfe4d6;
  --map-street: #fbfaf8;
  --map-road: #ffffff;
  --map-road-case: #d3cfc5;
  --map-future: #d9d6ce;
  --map-future-line: #c9c5bb;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 400 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
h1, h2 { margin: 0; font-stretch: 85%; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem); font-weight: 750; }
h2 { font-size: 1.35rem; font-weight: 700; }
.muted { color: var(--ink-2); margin: 4px 0 0; }
.cap { margin: 0 0 4px; font-size: .72rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* marca */
.brand { margin: 0; display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brand__name { font-weight: 800; font-stretch: 112%; letter-spacing: .06em; font-size: 1.05rem; }
.brand__sub { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }

/* botones y campos */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 1px solid var(--ink); border-radius: 999px; background: var(--ink); color: #fff; font-weight: 650; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.btn:hover { background: #2a2a2a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { background: rgba(0, 0, 0, .04); border-color: var(--ink-3); }
.btn--sm { min-height: 34px; padding: 0 14px; font-size: .85rem; }
.btn--block { width: 100%; }
.btn--light { color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn--light:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .6); }

.field { display: grid; gap: 6px; margin: 0 0 14px; min-width: 0; border: 0; padding: 0; }
.field > span, .field > legend { font-size: .8rem; font-weight: 600; color: var(--ink-2); padding: 0; }
.field em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.field input, .input { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; }
.field input:focus, .input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 138, 60, .18); }
.input--sm { min-height: 36px; width: auto; font-size: .88rem; }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; font-weight: 550; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; align-items: end; }
.span2 { grid-column: span 2; }
.error { min-height: 1.2em; margin: 0 0 8px; color: var(--danger); font-size: .88rem; font-weight: 550; }
.error:empty { min-height: 0; margin: 0; }
.hint { margin: -4px 0 12px; color: var(--ink-2); font-size: .85rem; }
.hint:empty { display: none; }

/* acceso */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); }
.login__card { width: min(380px, 100%); padding: 32px 28px 28px; background: var(--card); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.login__card .brand { margin-bottom: 26px; }

/* barra superior */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 0 clamp(16px, 3vw, 32px); min-height: 60px; background: var(--ink); color: #fff; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tab { flex: none; min-height: 60px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: rgba(255, 255, 255, .62); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab:hover { color: #fff; }
.tab[aria-current="true"] { color: #fff; border-bottom-color: var(--gold); }
.tab b { margin-left: 6px; font-weight: 500; color: rgba(255, 255, 255, .45); font-size: .82rem; }
.top__user { display: flex; gap: 6px; }
.top .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .22); }
.top .btn--ghost:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .5); }

/* contenido */
.is-vista-mapa .main { max-width: 1680px; }
.main { max-width: 1280px; margin: 0 auto; padding: 28px clamp(16px, 3vw, 32px) 120px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.head > div:first-child { flex: 1 1 320px; min-width: 0; }
.tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.tools__right { display: flex; gap: 8px; }
.tools__right input { width: 220px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); font-size: .86rem; font-weight: 600; cursor: pointer; }
.chip b { font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] b { color: rgba(255, 255, 255, .6); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--c, var(--ink-3)); }
.st-d { --c: var(--st-d); } .st-a { --c: var(--st-a); } .st-v { --c: var(--st-v); } .st-b { --c: var(--st-b); }

/* tabla */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: clip; }
.t-sub { display: none; color: var(--ink-3); font-size: .78rem; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { position: sticky; top: 60px; z-index: 1; padding: 10px 12px; background: #faf9f6; border-bottom: 1px solid var(--line); text-align: left; font-size: .72rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfaf7; }
.table tbody tr.is-sel { background: #f7f1e3; }
.table .num { text-align: right; }
.c-check { width: 40px; }
.c-check input, td input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--ink); cursor: pointer; }
.nm { color: var(--ink); font-weight: 600; }
.nm:empty::before { content: '—'; color: var(--line-2); font-weight: 400; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #f2e9d4; color: var(--gold-ink); font-size: .7rem; font-weight: 650; vertical-align: 1px; }
.upd { color: var(--ink-3); font-size: .82rem; }
.empty { margin: 0; padding: 40px 16px; text-align: center; color: var(--ink-2); }

.state { position: relative; display: inline-flex; align-items: center; }
.state .dot { position: absolute; left: 11px; pointer-events: none; }
.state select { appearance: none; min-height: 32px; padding: 0 28px 0 28px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a877f' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 11px center / 9px; font-size: .85rem; font-weight: 600; cursor: pointer; }
.state select:hover { border-color: var(--ink-3); }
.edit { border: 0; background: none; padding: 6px 8px; border-radius: 6px; color: var(--ink-2); font-weight: 600; font-size: .85rem; cursor: pointer; }
.edit:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }

/* barra de selección */
.bulk { position: fixed; left: 50%; bottom: 20px; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 20px; transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 999px; box-shadow: 0 16px 40px rgba(0, 0, 0, .3); white-space: nowrap; }
.bulk .input { background: #262626; border-color: #3a3a3a; color: #fff; }
.bulk .btn:not(.btn--ghost) { background: var(--gold); border-color: var(--gold); color: #111; }

/* diálogos */
.dialog { width: min(620px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.dialog--sm { width: min(420px, calc(100% - 32px)); }
.dialog::backdrop { background: rgba(10, 10, 10, .5); }
.dialog__body { padding: 24px; }
.dialog__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.x { width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: #f1f0ec; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.x:hover { background: #e6e4de; }

.seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.seg label { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 8px; font-size: .88rem; font-weight: 600; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); box-shadow: inset 0 0 0 1px var(--c); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }

.users { list-style: none; margin: 0 0 20px; padding: 0; border: 1px solid var(--line); border-radius: var(--r); }
.users li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.users li:last-child { border-bottom: 0; }
.users small { display: block; color: var(--ink-3); }
.users .edit { color: var(--danger); }

.toast { position: fixed; left: 50%; top: 76px; z-index: 50; max-width: calc(100% - 32px); padding: 10px 18px; transform: translate(-50%, -12px); border-radius: 999px; background: var(--ink); color: #fff; font-size: .9rem; font-weight: 550; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-err { background: var(--danger); }
.toast.has-accion { display: flex; align-items: center; gap: 14px; padding-right: 8px; pointer-events: auto; }
.toast__accion { min-height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; font-size: .85rem; font-weight: 650; cursor: pointer; }
.toast__accion:hover { background: rgba(255, 255, 255, .24); }
.toast.has-accion:not(.is-on) { pointer-events: none; }
.pn__pie .upd { margin: 0; }

::selection { background: #ead9b1; color: var(--ink); }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--card); font: 600 .78em/1.4 var(--font); color: var(--ink-2); text-align: center; }

/* cabecera: vista mapa / lista */
.head__acciones { display: flex; align-items: center; gap: 10px; }
.vista { display: inline-flex; padding: 3px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); }
.vista__btn { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font-weight: 650; font-size: .88rem; cursor: pointer; transition: background .15s, color .15s; }
.vista__btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.vista__btn:hover { color: var(--ink); }
.vista__btn[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* vendido y bloqueado llevan trama, para no depender solo del color */
.st-v .dot, .estado.st-v .dot { background: repeating-linear-gradient(135deg, var(--st-v) 0 2px, #e2b2ab 2px 3px); }
.st-b .dot, .estado.st-b .dot { background: repeating-linear-gradient(45deg, var(--st-b) 0 2px, #c9c9c4 2px 3px); }

/* ---------- mapa ---------- */
.mapa { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 16px; align-items: start; }
.mapa__lienzo { position: relative; height: clamp(460px, calc(100dvh - 250px), 860px); overflow: hidden; border: 1px solid var(--line); border-radius: var(--r); background: var(--map-ground); }
.plano { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.plano.is-arrastre { cursor: grabbing; }
.plano.is-area { cursor: crosshair; }
.plano .road-case { fill: none; stroke: var(--map-road-case); stroke-linecap: round; stroke-linejoin: round; }
.plano .road { fill: none; stroke: var(--map-road); stroke-linecap: round; stroke-linejoin: round; }
.plano .road.is-menor { stroke-dasharray: 3 2.4; }
.plano .site { fill: var(--map-site); stroke: var(--map-street); stroke-width: 9; stroke-linejoin: round; }
.plano .calles { fill: var(--map-street); stroke: var(--map-street); stroke-width: 13; stroke-linejoin: round; }
.plano .futuro { fill: var(--map-future); stroke: var(--map-future-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.plano .lote { stroke: #fff; stroke-width: 1; vector-effect: non-scaling-stroke; cursor: pointer; transition: opacity .18s; }
.plano .lote.st-d { fill: var(--st-d); }
.plano .lote.st-a { fill: var(--st-a); }
.plano .lote.st-v { fill: url(#trama-v); }
.plano .lote.st-b { fill: url(#trama-b); }
.plano .lote.is-dim { opacity: .22; }
.plano .trama-v { fill: var(--st-v); }
.plano .trama-b { fill: var(--st-b); }
.plano .trama-linea { stroke: rgba(255, 255, 255, .5); stroke-width: .7; }
.plano .sel { fill: none; stroke: var(--ink); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none; }
.plano .sel-halo { fill: none; stroke: #fff; stroke-width: 5.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none; }
.plano .hover { fill: none; stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.plano .area { fill: rgba(176, 138, 60, .12); stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.plano text { pointer-events: none; font-family: var(--font); paint-order: stroke; stroke-linejoin: round; text-anchor: middle; dominant-baseline: central; }
.plano .num { fill: var(--ink); stroke: rgba(255, 255, 255, .78); font-weight: 650; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .18s; }
.plano .mz { fill: var(--ink); stroke: rgba(255, 255, 255, .9); font-weight: 750; font-stretch: 88%; letter-spacing: .02em; transition: opacity .18s; }
.plano.is-cerca .num { opacity: 1; }
.plano.is-cerca .mz { opacity: 0; }
.plano .acceso rect { fill: var(--ink); }
.plano .acceso circle { fill: var(--ink); stroke: #fff; stroke-width: 2; }
.plano .acceso text { fill: #fff; stroke: none; font-size: 10px; font-weight: 700; letter-spacing: .08em; }

.mapa__multi { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); color: var(--ink); font-size: .85rem; font-weight: 650; cursor: pointer; box-shadow: 0 2px 8px rgba(20, 20, 20, .08); }
.mapa__multi svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mapa__multi:hover { border-color: var(--ink-3); }
.mapa__multi[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.mapa__zoom { position: absolute; right: 12px; bottom: 12px; display: grid; overflow: hidden; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); box-shadow: 0 2px 8px rgba(20, 20, 20, .08); }
.mapa__zoom button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; background: none; color: var(--ink); cursor: pointer; }
.mapa__zoom button + button { border-top: 1px solid var(--line); }
.mapa__zoom button:hover { background: #f4f3ef; }
.mapa__zoom svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.mapa__ayuda { position: absolute; left: 12px; bottom: 12px; margin: 0; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .86); color: var(--ink-2); font-size: .78rem; pointer-events: none; }
.mapa__estado { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; color: var(--ink-2); font-weight: 550; text-align: center; pointer-events: none; }
.mapa__estado:empty { display: none; }
.mapa__tip { position: absolute; top: 0; left: 0; z-index: 2; padding: 7px 11px; border-radius: 8px; background: var(--ink); color: #fff; font-size: .8rem; line-height: 1.35; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; }
.mapa__tip.is-on { opacity: 1; }
.mapa__tip b { font-weight: 700; }
.mapa__tip span { display: block; color: rgba(255, 255, 255, .72); }

/* panel lateral */
.mapa__panel { position: sticky; top: 76px; max-height: calc(100dvh - 92px); overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); overscroll-behavior: contain; }
.pn__cerrar { display: none; }
.pn__title { font-size: 1.45rem; font-weight: 750; overflow-wrap: anywhere; }
.pn__meta { margin: 4px 0 0; color: var(--ink-2); font-size: .9rem; font-variant-numeric: tabular-nums; }
.pn__texto { margin: 8px 0 18px; color: var(--ink-2); }
.pn__sec { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.pn__label { margin: 0 0 10px; font-size: .8rem; font-weight: 650; color: var(--ink-2); }
.pn__nota { margin: 8px 0 0; color: var(--ink-3); font-size: .8rem; }
.estados { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.estado { position: relative; display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); color: var(--ink); font-size: .88rem; font-weight: 600; text-align: left; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.estado .dot { width: 11px; height: 11px; }
.estado:hover { border-color: var(--ink-3); }
.estado[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); box-shadow: inset 0 0 0 1px var(--c); }
.estado:disabled { opacity: .55; cursor: progress; }
.pn__form { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.pn__form .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pn__acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.pn__acciones .btn { flex: 1 1 auto; white-space: nowrap; }
.btn:disabled { opacity: .4; cursor: default; }
.btn:disabled:hover { background: var(--ink); }
.pn__pie { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; justify-items: start; }
.link { padding: 4px 0; border: 0; background: none; color: var(--gold-ink); font-size: .88rem; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: pointer; }
.link:hover { color: var(--ink); }
.pn__resumen { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 16px 0 0; padding: 0; }
.pn__resumen li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: #f6f5f1; font-size: .85rem; font-weight: 600; }
.pn__resumen b { margin-left: auto; font-variant-numeric: tabular-nums; }
.pn__atajos { list-style: none; display: grid; gap: 8px; margin: 0 0 20px; padding: 0; color: var(--ink-2); font-size: .85rem; }
.pn__lista { display: flex; flex-wrap: wrap; gap: 5px; max-height: 132px; overflow: auto; margin: 14px 0 0; padding: 0; list-style: none; }
.pn__lista li { padding: 3px 9px; border-radius: 999px; background: #f2f0eb; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ---------- tamaños de pantalla ----------
   1180: laptops angostas y tablets horizontales (panel del mapa más angosto, tabla compacta)
   1100: las pestañas de desarrollos pasan a su propia fila
   1000: la tabla junta frente y fondo bajo la superficie
    900: tablet vertical: el plano a lo ancho y el panel como hoja inferior
    760: celular: encabezado no fijo, tabla en tarjetas, campos de 16 px (iOS no hace zoom)
    420: celular chico
   celular horizontal: plano a pantalla completa y panel lateral */

@media (max-width: 1180px) {
  .mapa { grid-template-columns: minmax(0, 1fr) 300px; }
  .mapa__panel { padding: 18px; }
  .table th.t-up, .table td.t-up { display: none; }
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 1180px) and (min-width: 761px) {
  /* Por si una columna no cabe: la tabla se desplaza de lado en vez de cortarse. */
  .table-wrap { overflow-x: auto; }
  .table th { position: static; }
}

@media (max-width: 1100px) {
  .top { flex-wrap: wrap; gap: 0 12px; padding-top: 10px; }
  .top .brand { flex: 1; }
  .tabs { order: 3; flex-basis: 100%; margin: 0 calc(-1 * clamp(16px, 3vw, 32px)); padding: 0 clamp(8px, 3vw, 24px); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
  .tabs::after { content: ''; flex: 0 0 28px; }
  .tab { min-height: 46px; }
  .mapa__panel { top: 122px; max-height: calc(100dvh - 138px); }
}

@media (max-width: 1000px) and (min-width: 761px) {
  .table th.t-ff, .table td.t-ff { display: none; }
  .t-sub { display: block; margin-top: 2px; }
}

/* Plano a lo ancho y panel como hoja inferior que aparece al elegir lotes. */
@media (max-width: 900px) {
  .mapa { display: block; }
  .mapa__lienzo { height: min(68dvh, 760px); }
  .mapa__panel { position: fixed; top: auto; left: max(0px, calc(50% - 320px)); right: max(0px, calc(50% - 320px)); bottom: 0; z-index: 30; max-height: 52dvh; padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); border: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(20, 20, 20, .18); transform: translateY(0); transition: transform .24s cubic-bezier(.2, .8, .2, 1); }
  .mapa__panel.is-vacio { transform: translateY(110%); visibility: hidden; }
  .mapa__panel::before { content: ''; display: block; width: 38px; height: 4px; margin: 0 auto 12px; border-radius: 4px; background: var(--line-2); }
  .pn__cerrar { display: grid; place-items: center; position: absolute; top: 14px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f1f0ec; color: var(--ink); cursor: pointer; }
  .pn__cerrar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .pn__title { padding-right: 44px; }
  .is-vista-mapa .main { padding-bottom: 40px; }
}

@media (max-width: 760px) {
  .top { position: relative; }
  .top__user .btn { padding: 0 12px; }
  #btn-pass { display: none; }
  .head { flex-direction: column; align-items: stretch; }
  .head > div:first-child { flex: none; }
  .head__acciones { flex-wrap: wrap; }
  .vista { flex: 1 1 auto; }
  .vista__btn { flex: 1; justify-content: center; }
  .head__acciones .btn { flex: 1 1 auto; }
  .chip { min-height: 34px; padding: 0 12px; gap: 6px; font-size: .84rem; }
  .tools__right { width: 100%; }
  .tools__right input { flex: 1; width: auto; min-width: 0; }
  input, select, textarea, .input, .input--sm { font-size: 16px; }
  .mapa__lienzo { height: 68dvh; margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .mapa__panel { left: 0; right: 0; }
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table tr { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "ck id st" "ck dim dim" "ck pr ed"; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table td { padding: 0; border: 0; }
  .table td.c-check { grid-area: ck; padding-top: 6px; }
  .table td.t-id { grid-area: id; align-self: center; font-weight: 650; }
  .table td.t-mz, .table td.t-nm, .table td.t-dim, .table td.t-up { display: none; }
  .table td.t-mob { grid-area: dim; display: block; color: var(--ink-2); font-size: .88rem; white-space: normal; }
  .table td.t-pr { grid-area: pr; text-align: left; align-self: center; }
  .table td.t-st { grid-area: st; }
  .table td.t-ed { grid-area: ed; justify-self: end; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3--fijo { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span2 { grid-column: span 2; }
  .seg { grid-template-columns: 1fr 1fr; }
  .bulk { left: 16px; right: 16px; transform: none; flex-wrap: wrap; justify-content: center; border-radius: 16px; padding: 12px; }
}
@media (min-width: 761px) { .t-mob, .t-mob-id { display: none; } }

@media (max-width: 420px) {
  .brand__sub { display: none; }
  .tools__right { flex-direction: column; }
  .tools__right select { width: 100%; }
  .grid3--fijo { gap: 0 8px; }
}

/* Celular horizontal (poca altura): el plano ocupa la pantalla y el panel sale por el costado. */
@media (max-height: 560px) and (orientation: landscape) {
  .top { position: relative; }
  .mapa { display: block; }
  .mapa__lienzo { height: calc(100dvh - 16px); }
  .mapa__panel { position: fixed; top: 0; bottom: 0; left: auto; right: 0; z-index: 30; width: min(340px, 48vw); max-height: none; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); border: 0; border-radius: 16px 0 0 16px; box-shadow: -12px 0 40px rgba(20, 20, 20, .18); transform: translateX(0); transition: transform .24s cubic-bezier(.2, .8, .2, 1); }
  .mapa__panel.is-vacio { transform: translateX(110%); visibility: hidden; }
  .mapa__panel::before { display: none; }
  .pn__cerrar { display: grid; place-items: center; position: absolute; top: 14px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f1f0ec; color: var(--ink); cursor: pointer; }
  .pn__cerrar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .pn__title { padding-right: 44px; }
}

@media (hover: none) { .mapa__ayuda { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
