:root {
  /* Paleta secundaria fija del sistema (--primary/--accent los define el panel
     Marca de forma dinamica en base.html; aqui solo agregamos lo que falta). */
  --earth: #9C6B3E;
  --earth-soft: #F1E6D8;

  /* Neutros con sesgo frio-azulado (coherente con la identidad navy), en vez
     de los grises verdosos heredados del branding original. */
  --surface: #FFFFFF;
  --surface-sunken: #F2F5F6;
  --line: #DCE3E6;
  --line-soft: #EAEFF0;
  --ink-900: #17242C;
  --ink-600: #526670;
  --ink-400: #93A4AB;

  /* Color semantico, deliberadamente separado del acento de marca. */
  --success: #2E7D5B;
  --success-soft: #E4F2EC;
  --warning: #B8720A;
  --warning-soft: #FBEEDC;
  --danger: #B3392F;
  --danger-soft: #FBEAE8;
  --info: #1565C0;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-pill: 999px;

  --text-xs: .74rem;
  --text-sm: .85rem;
  --text-base: .95rem;
  --text-md: 1.05rem;
  --text-lg: 1.4rem;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', "Segoe UI", system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--surface-sunken);
  color: var(--ink-900);
  line-height: 1.5;
}

/* ---------------------------------------------------------------- barra superior */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--primary); color: #fff;
  padding: 12px 26px; box-shadow: 0 2px 10px rgba(0,0,0,.16);
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { height: 42px; width: 42px; border-radius: var(--radius-sm); background: #ffffffdd; padding: 3px; }
.brand strong { display: block; font-family: var(--font-display); font-size: var(--text-md); letter-spacing: .2px; }
.brand small { display: block; opacity: .82; font-size: var(--text-xs); }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: #fff; text-decoration: none; font-weight: 500; font-size: var(--text-sm); }
.nav-links a:hover { color: var(--accent); }
.who { opacity: .82; font-size: var(--text-xs); font-family: var(--font-mono); }

/* ---------------------------------------------------------------- layout general */
.container { max-width: 1400px; margin: 24px auto; padding: 0 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.offline-banner {
  display: none; background: var(--danger); color: #fff; font-weight: 600; font-size: var(--text-sm);
  padding: 11px 16px; border-radius: var(--radius-sm); margin: 16px 0 0;
}
.pending-badge {
  border: 0; cursor: pointer; align-items: center; gap: 6px;
  background: var(--warning-soft); color: var(--warning); border: 1px solid #ecd4a8;
}

h1 { font-family: var(--font-display); font-size: var(--text-lg); color: var(--primary); margin: 8px 0; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-family: var(--font-display); font-size: var(--text-md); color: var(--primary); margin: 4px 0 14px; letter-spacing: -.01em; }
h3 { font-family: var(--font-display); }
.muted { color: var(--ink-600); }
.small { font-size: var(--text-sm); }
code, .chip, .btn, .btn-small, .btn-outline { font-family: var(--font-mono); }
code {
  background: var(--surface-sunken); border: 1px solid var(--line-soft);
  padding: 1px 6px; border-radius: 4px; font-size: .88em;
}

/* ---------------------------------------------------------------- paneles y tarjetas */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 18px 20px; margin: 16px 0; overflow-x: auto;
}
details.panel summary { cursor: pointer; font-weight: 600; color: var(--primary); font-family: var(--font-display); }
details.panel[open] summary { margin-bottom: 14px; }
.panel.danger-zone { border-color: #e7c3bd; background: var(--danger-soft); }
.panel.danger-zone h2 { color: var(--danger); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 18px; }
.card {
  display: block; position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 18px 20px 16px;
  text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
/* motivo de curvas de nivel (topografia) como marca de agua sutil, en vez de
   la clasica barra de acento al costado */
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .05;
  background-repeat: no-repeat; background-position: right -18px bottom -26px; background-size: 150px auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160'%3E%3Cpath d='M-10 120 Q 30 100 60 115 T 130 105 T 190 112' fill='none' stroke='%2317242C' stroke-width='4'/%3E%3Cpath d='M-10 140 Q 34 118 64 134 T 134 124 T 190 132' fill='none' stroke='%2317242C' stroke-width='4'/%3E%3Cpath d='M-10 100 Q 28 82 58 96 T 128 86 T 190 92' fill='none' stroke='%2317242C' stroke-width='4'/%3E%3C/svg%3E");
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(15,40,55,.14); border-color: var(--accent); }
.card h3 { margin: 0 0 4px; padding-right: 52px; color: var(--primary); font-size: var(--text-md); word-break: break-word; }
.card p { position: relative; font-size: var(--text-sm); color: var(--ink-600); margin: 4px 0; }
.card footer {
  position: relative; display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.card footer .small { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* menu de tres puntos en la tarjeta de proyecto (descargar / eliminar) */
.card-wrap { position: relative; }
.card-menu { position: absolute; top: 6px; right: 4px; z-index: 2; }
.card-menu-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm); border: 0; cursor: pointer;
  background: rgba(255,255,255,.85); color: var(--ink-600); font-size: 1.15rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.card-menu-btn:hover { background: var(--surface-sunken); color: var(--primary); }
.card-menu-dropdown {
  display: none; position: absolute; top: 42px; right: 4px; min-width: 195px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 10px 26px rgba(15,40,55,.2); overflow: hidden;
}
.card-menu-dropdown.open { display: block; }
.card-menu-dropdown a, .card-menu-dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 10px 12px; font-size: var(--text-sm); font-family: var(--font-body); font-weight: 500;
  background: none; border: 0; cursor: pointer; color: var(--ink-900); text-decoration: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.card-menu-dropdown a:hover, .card-menu-dropdown button:hover { background: var(--surface-sunken); }
.card-menu-dropdown button.danger-item { color: var(--danger); }

.chip {
  background: var(--accent); color: #17241d; border-radius: var(--radius-pill);
  padding: 3px 11px; font-size: var(--text-xs); font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- formularios */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; align-items: end; min-width: 0; }
.form-grid .full { grid-column: 1 / -1; }
/* min-width:0 en cada celda: sin esto, un <select> con una opcion de texto
   largo (ej. "Zona UTM", "Orden de columnas") fuerza a toda la columna del
   grid a ensancharse para caber esa opcion, empujando el resto del
   formulario fuera del panel (scroll horizontal no deseado). */
.form-grid > * { min-width: 0; }
label { display: flex; flex-direction: column; gap: 5px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-900); min-width: 0; }
input, select, textarea {
  font: inherit; font-weight: 400; padding: 9px 11px; font-size: var(--text-base);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink-900); min-width: 0; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[type=color] { padding: 2px; height: 40px; width: 90px; }
.dropzone {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: 10px;
  background: var(--surface-sunken); transition: border-color .15s, background .15s;
}
.dropzone.drag-over { border-color: var(--primary); background: var(--surface); }
.dropzone input[type=file] { border: 0; padding: 0; background: transparent; width: 100%; }
.dropzone-hint { font-size: var(--text-xs); font-weight: 400; color: var(--ink-600); }
label.check { flex-direction: row; align-items: center; font-weight: 400; gap: 7px; }
.checks { display: flex; flex-wrap: wrap; gap: 5px 16px; font-weight: 400; }
.select-all-row { padding-bottom: 4px; margin-bottom: 6px; border-bottom: 1px dashed var(--line); }
.inline-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn {
  background: var(--primary); color: #fff; border: 0; border-radius: var(--radius-sm);
  padding: 10px 22px; font-size: var(--text-base); font-weight: 600; cursor: pointer;
  justify-self: start;
}
.btn:hover { filter: brightness(1.12); }
.btn:focus-visible, .btn-small:focus-visible, .btn-outline:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--info); outline-offset: 2px;
}
.btn-outline {
  border: 1.5px solid var(--primary); color: var(--primary); background: transparent;
  border-radius: var(--radius-sm); padding: 7px 14px; text-decoration: none; font-weight: 600;
}
.nav-links .btn-outline { border-color: #fff; color: #fff; }
.btn-small {
  background: var(--primary); color: #fff; border: 0; border-radius: var(--radius-sm);
  padding: 5px 11px; font-size: var(--text-xs); cursor: pointer; text-decoration: none;
  display: inline-block;
}
.btn-small.danger { background: var(--danger); }
.btn-small.comment { background: #5c6bc0; }
.btn-small.gps { background: var(--info); padding: 9px 14px; font-size: var(--text-sm); }

table.files { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.files th {
  text-align: left; color: var(--ink-600); font-weight: 600; padding: 7px 8px;
  border-bottom: 2px solid var(--line); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .03em;
}
table.files td { padding: 9px 8px; border-bottom: 1px solid var(--line-soft); }
td.actions { display: flex; gap: 6px; align-items: center; }
td.actions form { margin: 0; }

.flash { padding: 11px 16px; border-radius: var(--radius-sm); margin: 10px 0; font-weight: 500; font-size: var(--text-sm); }
.flash-ok { background: var(--success-soft); color: var(--success); border: 1px solid #bfe0cf; }
.flash-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #f0c1bc; }

/* ---------------------------------------------------------------- espacio de trabajo del proyecto */
/* el mapa ocupa toda la pantalla (se escapa del .container centrado) y la
   barra de navegacion de areas/carpetas flota encima como una tarjeta,
   al estilo de un panel de mapa inmersivo */
.workspace {
  position: relative;
  width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  height: calc(100vh - 91px);
  min-height: 480px;
}
.viewer { position: absolute; inset: 0; z-index: 1; }
#map { height: 100%; width: 100%; border-radius: 0; border: 0; }

/* ---- riel de iconos flotante + panel desplegable (estilo "layer catalog") ----
   reemplaza la antigua tarjeta lateral: ahora todo vive detras de botones de
   icono, el mapa queda fijo y no hay que desplazarse para nada */
/* riel a todo lo alto de la ventana, pegado al borde izquierdo justo debajo
   de la barra superior -- el nombre del proyecto se corre a una franja
   angosta a la derecha del riel, del alto de un solo boton, para que el
   panel desplegable siempre empiece debajo de ella y nunca se sobreponga */
.tool-rail {
  position: absolute; top: 0; left: 0; bottom: 0; z-index: 25;
  width: 80px; display: flex; flex-direction: column; gap: 4px;
  background: rgba(11,59,92,.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 8px 5px; overflow-y: auto;
  box-shadow: 0 10px 34px rgba(6,26,41,.32);
}

.project-badge {
  position: absolute; top: 0; left: 88px; z-index: 26; height: 58px;
  display: flex; flex-direction: column; justify-content: center;
  max-width: min(320px, calc(100vw - 104px));
  background: rgba(11,59,92,.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #eaf4ff; padding: 6px 16px; border-radius: 0 0 var(--radius-md) 0;
  box-shadow: 0 8px 24px rgba(6,26,41,.3);
}
.project-badge strong { display: block; font-family: var(--font-display); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-badge span { display: block; font-size: .7rem; color: #b7d6ea; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  color: #dbeeff; padding: 8px 2px; cursor: pointer; font-family: var(--font-mono);
  text-decoration: none; position: relative; flex-shrink: 0;
}
.rail-btn .rail-icon { font-size: 1.2rem; line-height: 1; }
.rail-btn .rail-icon svg { width: 1.2em; height: 1.2em; vertical-align: -0.15em; display: inline-block; }
.rail-btn .rail-label { font-size: .6rem; letter-spacing: .02em; font-weight: 600; text-transform: uppercase; line-height: 1.15; }
.rail-btn:hover { background: rgba(255,255,255,.14); }
.rail-btn.active { background: #fff; color: var(--primary); }
.rail-spacer { flex: 1; min-height: 6px; }
.rail-divider { height: 1px; background: rgba(255,255,255,.2); margin: 4px 6px; flex-shrink: 0; }
.rail-count {
  position: absolute; top: 2px; right: 10px; background: var(--accent); color: #0B2620;
  font-size: .6rem; font-weight: 700; border-radius: 999px; min-width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

.tool-panel {
  position: absolute; top: 66px; left: 88px; z-index: 24;
  width: 360px; max-width: calc(100vw - 104px);
  max-height: calc(100% - 82px); overflow-y: auto; overflow-x: hidden; display: none;
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 14px 16px; box-shadow: 0 10px 34px rgba(15,40,55,.22);
}
.tool-panel.open { display: block; }
.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-title-row h2 { margin: 0; font-size: var(--text-md); color: var(--primary); font-family: var(--font-display); }
.panel-close { background: transparent; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--ink-600); line-height: 1; padding: 2px 4px; }
.panel-close:hover { color: var(--danger); }

.mini-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.mini-icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface-sunken); color: var(--primary); font-size: 1.05rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; position: relative; padding: 0;
}
.mini-icon-btn:hover, .mini-icon-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.mini-icon-btn[title]:hover::after {
  content: attr(title); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink-900); color: #fff; font-size: .68rem; white-space: nowrap; font-weight: 500;
  padding: 4px 8px; border-radius: 4px; z-index: 5; pointer-events: none;
}
.mini-form { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; display: none; }
.mini-form.open { display: block; }
.mini-form .form-grid { grid-template-columns: 1fr; }

@media (max-width: 640px) {
  .tool-rail { width: 62px; }
  .rail-btn .rail-icon { font-size: 1.05rem; }
  .rail-btn .rail-label { font-size: .54rem; }
  .tool-panel { left: 70px; max-width: calc(100vw - 86px); }
  .project-badge { left: 70px; max-width: calc(100vw - 86px); }
}

.folder-acc { border-bottom: 1px solid var(--line-soft); padding: 7px 0; }
.folder-acc summary {
  cursor: pointer; font-weight: 600; font-size: var(--text-sm); color: var(--ink-900);
  display: flex; align-items: center; gap: 8px;
}
.file-list { list-style: none; margin: 8px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-row {
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 9px 10px;
  display: flex; flex-direction: column; gap: 6px;
  transition: background .15s ease, border-color .15s ease;
}
.file-row.obs-selected { background: #dbeafc; border-color: var(--info); }
.file-row[draggable="true"] { cursor: grab; }
.file-row.dragging { opacity: .4; }
.folder-acc > summary.drop-target-active {
  background: var(--accent); color: #0B2620; outline: 2px dashed var(--primary); outline-offset: -2px;
}
.file-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-name { font-size: var(--text-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-600); font-variant-numeric: tabular-nums; }
.file-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  width: 30px; height: 30px; border-radius: var(--radius-sm); border: 0; cursor: pointer;
  background: var(--primary); color: #fff; font-size: .95rem; text-decoration: none;
  line-height: 1; padding: 0;
}
.icon-btn:hover { filter: brightness(1.15); }
.icon-btn.danger { background: var(--danger); }
.icon-btn.comment { background: #5c6bc0; }
label.icon-btn.map-toggle-sm { width: auto; padding: 0 8px; background: var(--surface-sunken); color: var(--primary); gap: 5px; border: 1px solid var(--line); }
label.icon-btn.map-toggle-sm input { width: 13px; height: 13px; cursor: pointer; }
label.icon-btn.map-toggle-sm:has(input:checked) { background: var(--accent); color: #0B2620; border-color: var(--accent); }

@media (max-width: 1000px) {
  .workspace { height: calc(100vh - 152px); min-height: 420px; }
  .sidebar {
    top: 10px; left: 10px; right: 10px; width: auto; max-width: none;
    max-height: 42vh;
  }
}

/* ---------------------------------------------------------------- login */
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; cursor: pointer;
  font-size: 1.1rem; padding: 4px 8px; border-radius: var(--radius-sm); line-height: 1;
}
.pw-toggle:hover { background: var(--surface-sunken); }

.login-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.login-card {
  position: relative;
  background: var(--surface); border-radius: 16px; padding: 38px 42px; width: 380px;
  box-shadow: 0 16px 40px rgba(15,40,55,.14); text-align: center;
  border-top: 4px solid var(--primary);
}
.login-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-top: 20px; }
.login-logo { height: 72px; }
.login-card h1 { font-size: 1.3rem; margin: 12px 0 2px; letter-spacing: -.01em; }
.back-to-site {
  position: absolute; top: 16px; left: 18px;
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-600); text-decoration: none;
}
.back-to-site:hover { color: var(--primary); }

/* ---------------------------------------------------------------- menu de carpeta */
.folder-menu-wrap { position: relative; display: inline-flex; margin-left: auto; }
.folder-menu-dropdown {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 8px 20px rgba(0,0,0,.2); z-index: 30; min-width: 210px; padding: 4px;
}
.folder-menu-dropdown.open { display: block; }
.folder-menu-dropdown a {
  display: block; padding: 8px 10px; font-size: var(--text-sm); color: var(--ink-900);
  text-decoration: none; border-radius: 4px; white-space: nowrap;
}
.folder-menu-dropdown a:hover { background: var(--surface-sunken); }

.dibujo-edit {
  display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--line);
}
.dibujo-edit label { font-size: .78rem; }
.dibujo-edit input[type=text] { padding: 5px 8px; font-size: .82rem; }
.icono-picker { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px; background: var(--surface-sunken); border-radius: var(--radius-sm); }
.icono-picker-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: 2px solid transparent; border-radius: var(--radius-sm); background: var(--surface);
  cursor: pointer; padding: 0; color: inherit;
}
.icono-picker-btn:hover { background: rgba(0,0,0,.06); }
.icono-picker-btn.selected { border-color: var(--primary); background: rgba(0,0,0,.06); }
.dibujo-edit input[type=color] { height: 30px; padding: 2px; }

/* ---------------------------------------------------------------- espacio en disco */
.disk-bar {
  width: 100%; height: 14px; border-radius: 999px; background: var(--surface-sunken);
  border: 1px solid var(--line); overflow: hidden; margin: 10px 0 8px;
}
.disk-bar-fill { height: 100%; background: var(--primary); border-radius: 999px 0 0 999px; }
.disk-stats { font-size: var(--text-sm); color: var(--ink-900); }

/* ---------------------------------------------------------------- perfil de elevacion */
.elev-stats {
  display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--text-sm); margin-top: 10px;
}
/* Panel FLOTANTE (no un modal con fondo oscuro que tape el mapa): asi se
   puede ver el mapa y el perfil al mismo tiempo, y seguir con el mouse el
   punto del grafico sobre la ubicacion real que se dibuja en el mapa. */
.elevation-float {
  display: none; flex-direction: column;
  position: fixed; z-index: 1100; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(480px, 92vw); max-height: 48vh;
  background: var(--surface); border-radius: 12px; overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,.4);
}
.elevation-float header {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  background: var(--primary); color: #fff; padding: 8px 14px;
}
.elevation-float-body { padding: 12px 16px; overflow: auto; }

/* ---------------------------------------------------------------- buscador de seguimiento */
.seg-search {
  display: flex; align-items: center; gap: 8px; background: var(--surface-sunken);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px;
  margin-bottom: 12px;
}
.seg-search-icon { font-size: .95rem; opacity: .7; flex-shrink: 0; }
.seg-search input {
  border: 0; background: transparent; flex: 1; font-size: var(--text-sm);
  padding: 4px 0; min-width: 0;
}
.seg-search input:focus { outline: none; }
.seg-search-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.seg-search-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px;
}

/* ---------------------------------------------------------------- linea de tiempo */
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 3px solid var(--accent); }
.timeline li { position: relative; padding: 6px 0 6px 14px; font-size: var(--text-sm); }
.timeline li::before {
  content: ""; position: absolute; left: -21px; top: 13px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--surface);
}
.t-date { display: block; color: var(--ink-600); font-size: var(--text-xs); font-family: var(--font-mono); }

/* ---------------------------------------------------------------- grabacion de audio / video */
.rec-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: -8px; }
.rec-row audio { height: 36px; max-width: 100%; }
.rec-timer { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--danger); font-size: var(--text-sm); }

.chat-input-wrap { position: relative; }
.chat-input-wrap textarea { width: 100%; padding-right: 78px; }
.chat-mic-btn, .chat-video-btn {
  position: absolute; bottom: 8px; width: 30px; height: 30px; border-radius: 50%;
  border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.35); line-height: 1;
}
.chat-mic-btn { right: 8px; background: var(--primary); }
.chat-mic-btn:hover, .chat-video-btn:hover { filter: brightness(1.12); }
.chat-mic-btn.grabando { background: var(--danger); animation: pulso 1.2s infinite; }
.chat-video-btn { right: 44px; background: #00796b; }

/* mini formulario de observacion al hacer clic en el mapa */
.map-obs-popup { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.map-obs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.map-obs-head .mini-icon-btn { width: 30px; height: 30px; font-size: .95rem; flex-shrink: 0; }
.map-obs-popup textarea { font: inherit; font-size: var(--text-sm); padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--line); resize: vertical; }
.map-obs-popup input[type=file] { font-size: var(--text-xs); }

/* marcador de observacion de terreno en el mapa: solo el icono, sin circulo
   ni halo alrededor (mismo tratamiento que el punto de "mi ubicacion en vivo") */
.obs-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: transparent; border: 0;
  font-size: 1.7rem; line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.6));
}
.obs-icon.temp { opacity: .7; }

/* puntos de topografia (CSV/TXT subidos): icono de ubicacion rojo, bien
   visible, con la descripcion siempre a la vista (sin necesidad de clic) */
.topo-pt-icon {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
}
.dibujo-pt-icon {
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.6));
  width: 44px; height: 44px;
}
.dibujo-pt-icon > span { display: flex; width: 100%; height: 100%; }
.dibujo-pt-icon svg { width: 100%; height: 100%; display: block; }
.topo-pt-label {
  background: rgba(255,255,255,.92) !important; border: 1px solid var(--line) !important;
  color: var(--ink-900) !important; font-size: .68rem; font-weight: 600; padding: 1px 5px !important;
  border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.topo-pt-label::before { display: none; }
.obs-cota-tooltip {
  background: var(--primary) !important; border: 1px solid var(--primary) !important;
  color: #fff !important; font-size: .68rem; font-weight: 600; padding: 1px 5px !important;
  border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.obs-cota-tooltip::before { display: none; }
@keyframes pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, .5); }
  50% { box-shadow: 0 0 0 10px rgba(198, 40, 40, 0); }
}

/* boton y punto de "mi ubicacion en vivo" */
.live-locate-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; font-size: 1rem; background: var(--surface); text-decoration: none;
}
.live-locate-btn.active { background: var(--info); filter: brightness(1.1); }
/* Solo el icono, sin circulo ni halo alrededor. */
.live-dot {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; font-size: 1.6rem; line-height: 1;
  background: transparent; border: 0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.6));
}

/* ---------------------------------------------------------------- visor de PDF y modales */
#pdf-modal, .overlay-modal {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(10, 20, 26, .78);
  align-items: center; justify-content: center; padding: 3vh 3vw;
}
.pdf-box.small-box { height: auto; max-height: 85vh; width: min(560px, 100%); }
#comment-body { padding: 18px 22px; overflow: auto; }
#comment-body p { white-space: pre-wrap; margin-top: 0; }
#comment-body img { max-width: 100%; border-radius: var(--radius-sm); }
#comment-body audio { width: 100%; }
#comment-body video { max-width: 100%; border-radius: var(--radius-sm); background: #000; }
.share-body { padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.share-option {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 12px 14px; font-size: var(--text-sm); font-family: var(--font-body); font-weight: 500;
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--ink-900); text-decoration: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.share-option:hover { background: var(--surface-sunken); }
.share-option-icon { font-size: 1.2rem; width: 24px; text-align: center; flex-shrink: 0; }
.share-option .share-status { margin-left: auto; }
.pdf-box {
  background: var(--surface-sunken); border-radius: 12px; width: min(960px, 100%);
  height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 48px rgba(0,0,0,.4);
}
.pdf-box header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--primary); color: #fff; padding: 10px 16px; gap: 12px;
}
#pdf-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-controls { display: flex; gap: 8px; flex-shrink: 0; }
.pdf-controls button {
  background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: var(--radius-sm);
  width: 34px; height: 34px; font-size: 1.05rem; cursor: pointer;
}
.pdf-controls button:hover { background: rgba(255,255,255,.32); }
#pdf-pages { flex: 1; overflow: auto; text-align: center; padding: 12px; }
#pdf-pages canvas { display: block; margin: 0 auto 12px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25); }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 8px; padding: 10px 12px; }
  .nav-links { flex-wrap: wrap; justify-content: center; gap: 10px 14px; }
  .container { padding: 0 10px; margin-top: 12px; }
  .page-head { flex-wrap: wrap; }
  .login-card { width: 100%; padding: 28px 22px; }
  td.actions { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .icon-btn, .btn { transition: none; }
  .chat-mic-btn.grabando { animation: none; }
}
