
/* ================================================================
   LAPSO 18 SERVIALPA — Main Stylesheet
   Colors: #0d1b2a (dark navy), #1565C0 (blue), #fff (white)
   Font: Barlow Condensed (headings) + Barlow (body)
================================================================ */
:root {
  --navy:   #0d1b2a;
  --blue:   #1565C0;
  --blue-l: #1E88E5;
  --blue-xl:#E3F2FD;
  --green:  #43A047;
  --green-l:#C8E6C9;
  --white:  #ffffff;
  --gray-1: #F5F7FA;
  --gray-2: #E8ECF0;
  --gray-3: #B0BEC5;
  --gray-4: #78909C;
  --text:   #1A2332;
  --text-2: #546E7A;
  --danger: #E53935;
  --shadow: 0 2px 12px rgba(13,27,42,.12);
  --shadow-lg: 0 8px 32px rgba(13,27,42,.18);
  --radius: 10px;
  --radius-sm: 6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Barlow', sans-serif;
  background: var(--gray-1);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── TYPOGRAPHY ── */
h1,h2,h3,h4 { font-family: 'Barlow Condensed', sans-serif; }

/* ── NAVBAR ──────────────────────────────────────────────────── */
.navbar {
  background: var(--navy);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.nav-logo-img {
  height: 42px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  display: block;
  background: #fff;
  border-radius: 6px;
  padding: 3px 6px;
  filter: none !important;
}
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-link { color: rgba(255,255,255,.75); text-decoration: none; font-size: 14px; font-weight: 500; transition: color .2s; }
.nav-link:hover { color: #fff; }
.nav-user { color: rgba(255,255,255,.6); font-size: 13px; }
.nav-logout { color: rgba(255,255,255,.5); text-decoration: none; font-size: 13px; transition: color .2s; }
.nav-logout:hover { color: #fff; }

/* ── LOGIN ──────────────────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-bg {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--navy) 0%, #1a3a6e 100%);
}
.login-bg::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 60px,
    rgba(255,255,255,.02) 60px, rgba(255,255,255,.02) 61px
  ),
  repeating-linear-gradient(
    90deg, transparent, transparent 60px,
    rgba(255,255,255,.02) 60px, rgba(255,255,255,.02) 61px
  );
}
.login-wrap { position: relative; z-index: 1; width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; justify-content: center; margin-bottom: 8px; }
.login-logo-img { width: 200px; height: auto; object-fit: contain; }
.login-subtitle { text-align: center; font-size: 13px; color: var(--text-2); font-weight: 500; margin-bottom: 24px; letter-spacing: .3px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-footer { margin-top: 20px; text-align: center; font-size: 12px; color: var(--gray-3); }

/* ── FORM ELEMENTS ──────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-group input,
.field-group select,
.field-group textarea {
  border: 2px solid var(--gray-2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px;
  font-family: 'Barlow', sans-serif;
  color: var(--text);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-check { justify-content: flex-end; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check-label input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); }
.mt-2 { margin-top: 12px; }

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Barlow', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s, transform .1s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--blue-l); }
.btn-primary:active { transform: scale(.98); }
.btn-primary svg { width: 16px; height: 16px; }
.btn-full { width: 100%; justify-content: center; padding: 12px 20px; font-size: 15px; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  color: var(--blue);
  border: 2px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Barlow', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s;
}
.btn-outline:hover { background: var(--blue-xl); }

.btn-outline-sm  { display:inline-block; padding:6px 12px; border:1.5px solid var(--blue); color:var(--blue); border-radius:5px; font-size:12px; font-weight:600; text-decoration:none; transition:background .2s; }
.btn-outline-sm:hover { background:var(--blue-xl); }
.btn-blue-sm     { display:inline-block; padding:6px 12px; background:var(--blue); color:#fff; border-radius:5px; font-size:12px; font-weight:600; text-decoration:none; }
.btn-danger-sm   { display:inline-block; padding:6px 10px; background:var(--danger); color:#fff; border-radius:5px; font-size:12px; font-weight:600; text-decoration:none; }

/* ── MAIN LAYOUT ──────────────────────────────────────────────── */
.app-page { background: var(--gray-1); }
.main-content { max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }
.main-content.narrow { max-width: 720px; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title { font-size: 28px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.page-sub   { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.back-link  { font-size: 13px; color: var(--blue); text-decoration: none; margin-bottom: 6px; display: inline-block; }
.back-link:hover { text-decoration: underline; }

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert-error {
  background: #FFEBEE; border-left: 4px solid var(--danger);
  color: #B71C1C; padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 20px; font-size: 14px;
}
.toast-success {
  background: #E8F5E9; border-left: 4px solid var(--green);
  color: #1B5E20; padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 20px; font-size: 14px;
  transition: opacity .5s;
}

/* ── REPORTS GRID ─────────────────────────────────────────────── */
.reports-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.report-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.report-card:hover { border-color: var(--blue); box-shadow: var(--shadow-lg); }
.report-card.published { border-color: rgba(67,160,71,.4); }
.rc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rc-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.badge-draft { background: var(--gray-2); color: var(--text-2); }
.badge-pub   { background: var(--green-l); color: #1B5E20; }
.rc-date   { font-size: 12px; color: var(--gray-3); }
.rc-title  { font-size: 18px; font-weight: 700; color: var(--navy); line-height: 1.2; margin-bottom: 6px; }
.rc-freq   { font-size: 13px; color: var(--blue); margin-bottom: 4px; }
.rc-dates  { font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.rc-progress { margin-bottom: 14px; }
.progress-bar { height: 6px; background: var(--gray-2); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.progress-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width .5s; }
.progress-txt { font-size: 11px; color: var(--text-2); }
.rc-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── EMPTY STATE ──────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 16px; display: block; }
.empty-state h3 { font-size: 20px; color: var(--navy); margin-bottom: 8px; }
.empty-state p  { font-size: 14px; color: var(--text-2); }

/* ── FORM CARD ────────────────────────────────────────────────── */
.form-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.form-section { padding: 24px; border-bottom: 1px solid var(--gray-2); }
.form-section:last-of-type { border-bottom: none; }
.form-section-title { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 16px; }
.form-actions { padding: 20px 24px; display: flex; justify-content: flex-end; gap: 12px; background: var(--gray-1); }

/* ── PROGRESS PANEL ──────────────────────────────────────────── */
.progress-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.progress-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.progress-label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.progress-count { font-size: 15px; color: var(--navy); }
.progress-count strong { font-size: 22px; font-weight: 800; color: var(--blue); }
.progress-bar-lg { height: 12px; background: var(--gray-2); border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.progress-fill-lg { height: 100%; background: linear-gradient(90deg, var(--green) 0%, #66BB6A 100%); border-radius: 6px; transition: width .8s ease; }
.legend-row { display: flex; gap: 20px; font-size: 12px; color: var(--text-2); }
.legend-green { color: var(--green); }
.legend-dark  { color: #555; }

/* ── ZONE MAP TABLE ─────────────────────────────────────────────── */
.map-container {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 20px 12px;
  margin-bottom: 24px;
  overflow: hidden;
}
.map-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: .5px;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.zone-map-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-3) var(--gray-1);
}
.zone-map-scroll::-webkit-scrollbar { height: 6px; }
.zone-map-scroll::-webkit-scrollbar-track { background: var(--gray-1); }
.zone-map-scroll::-webkit-scrollbar-thumb { background: var(--gray-3); border-radius: 3px; }

/* ── THE TABLE ──────────────────────────────────────────────────────
   Row height base: 38px per row · 6 zone rows + label row + km row
   Wide  (rowspan=3) → ~ 38 × 3 + 2·spacing  ≈ 120px tall
   Med   (rowspan=2) → ~ 38 × 2 + 1·spacing  ≈  79px tall
   Small (rowspan=1) →           38px         ≈  38px tall
   ──────────────────────────────────────────────────────────────────── */
.zone-map-tbl {
  border-collapse: separate;
  border-spacing: 3px;
  table-layout: fixed;
  min-width: max-content;
  /* belt-and-suspenders: keep table from collapsing to weird heights */
  empty-cells: show;
}

/* LABEL ROW — text rotated vertically using .lbl-inner */
.map-row-lbl td {
  height: 96px;
  padding: 0;
  vertical-align: bottom;
  overflow: hidden;
  background: transparent;
}
/* The div inside each label cell handles rotation and sizing */
.lbl-inner {
  display: block;
  height: 88px;
  width: 100%;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-2);
  text-align: left;
  line-height: 1.15;
  letter-spacing: .3px;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  -webkit-writing-mode: vertical-rl;   /* Safari < 14 */
  transform: rotate(180deg);
  white-space: normal;
  overflow: hidden;
  word-break: break-word;
  padding: 4px 1px 0;
}
.map-row-lbl .lbl-dark .lbl-inner { color: #999; }

/* ZONE ROWS — each row is 38px tall; rowspan stacks them */
.map-row-z {
  height: 38px;
}
.map-row-z td { height: 38px; }      /* force per-cell so collapse never happens */

/* KM ROW */
.map-row-km td {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 9px;
  color: var(--text-2);
  font-weight: 700;
  padding: 6px 0 0;
  text-align: center;
  white-space: nowrap;
  letter-spacing: .3px;
  max-width: 0;           /* allow text to visually overflow without expanding column */
  overflow: visible;
}

/* EMPTY SPACER (transparent cells used to anchor rows) */
.map-empty {
  background: transparent !important;
  border: none !important;
  padding: 0;
  height: 38px;
}

/* DARK BLOCK (Aeropuerto, Metropark, Tramo Marino) — rowspan=6 → full height */
.map-dark {
  background: #3a3a3a;
  border-radius: 6px;
  color: #cfcfcf;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
  padding: 6px 2px;
  line-height: 1.3;
  letter-spacing: .3px;
  text-transform: uppercase;
  cursor: default;
  /* explicit minimum so column never collapses on stale CSS */
  min-width: 44px;
}
.dk-km {
  display: block;
  color: var(--blue-l);
  font-size: 9px;
  margin-top: 6px;
  font-weight: 700;
}

/* ── ZONE CELLS (clickable <td>) ─────────────────────────────────── */
.map-z {
  cursor: pointer;
  border-radius: 5px;
  background: #ffffff;
  border: 1.5px solid #BDBDBD;
  text-align: center;
  vertical-align: middle;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  color: #555;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
  padding: 0;
  user-select: none;
}
.map-z:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #EEF4FF;
  z-index: 3;
  position: relative;
}
.map-z:active { transform: scale(.97); }

.map-z.zone-done {
  background: #43A047;
  border-color: #2E7D32;
  color: #fff;
}
.map-z.zone-done:hover { background: #2E7D32; }

/* SIZE VARIANTS — explicit min-height so cells never collapse */
/* Wide  (rowspan=3) — Entronques: big square ≈ 50×120 */
.z-wide {
  font-size: 22px;
  border-radius: 7px;
  border-width: 2px;
  min-height: 120px;
}
/* Med   (rowspan=2) — Pte. del Este, Boca La Caja: ≈ 30×79 */
.z-med {
  font-size: 14px;
  border-radius: 5px;
  min-height: 79px;
}
/* Small (rowspan=1) — most numbered zones: ≈ 30×38 */
.z-sm {
  font-size: 13px;
  border-radius: 4px;
  min-height: 38px;
}

/* ── ZONE LIST below the map ─────────────────────────────────────── */

/* ── ZONE GRID (list view for mobile) ────────────────────────── */
.zone-list-section { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.section-title { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 16px; }
.zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}
.zone-tile {
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: transform .15s, background .2s, border-color .2s;
  border: 2px solid #BDBDBD;
}
.zone-tile:hover { transform: scale(1.05); border-color: var(--blue); }
.zone-tile.zone-tile-done { background: #2E7D32; border-color: #1B5E20; }
.zt-number { font-size: 13px; font-weight: 700; color: #444; }
.zt-status { font-size: 11px; color: #888; margin-top: 2px; }
.zone-tile.zone-tile-done .zt-number,
.zone-tile.zone-tile-done .zt-status { color: #fff; }

/* ── MODAL ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(13,27,42,.65);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(2px);
  padding: 0;
}
@media (min-width: 600px) {
  .modal-overlay { align-items: center; padding: 20px; }
}
.modal-card {
  background: #fff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}
@media (min-width: 600px) {
  .modal-card { border-radius: 16px; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--gray-2);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-header h3 { font-size: 22px; font-weight: 800; color: var(--navy); }
.modal-close {
  background: var(--gray-2); border: none; border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.modal-close:hover { background: var(--gray-3); }
.modal-body { padding: 20px; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--gray-2); display: flex; justify-content: flex-end; }

/* ── PHOTO GALLERY ────────────────────────────────────────────── */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.photo-item { position: relative; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 4/3; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del-btn {
  position: absolute; top: 6px; right: 6px;
  background: rgba(229,57,53,.9); color: #fff;
  border: none; border-radius: 50%;
  width: 26px; height: 26px; cursor: pointer;
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.photo-item:hover .photo-del-btn { opacity: 1; }
.no-photos-msg { font-size: 13px; color: var(--gray-4); font-style: italic; padding: 8px 0; }

/* ── UPLOAD AREA ─────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--gray-2);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  transition: border-color .2s, background .2s;
  margin-bottom: 16px;
}
.upload-area.drag-over {
  border-color: var(--blue);
  background: var(--blue-xl);
}
.upload-icon svg { width: 48px; height: 48px; margin: 0 auto 10px; display: block; }
.upload-text { font-size: 14px; color: var(--text-2); margin-bottom: 12px; }
.upload-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.upload-btns .btn-outline { padding: 8px 16px; font-size: 13px; }
.upload-progress { margin-top: 12px; }
.upload-bar { height: 6px; background: var(--gray-2); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.upload-bar-fill { height: 100%; background: var(--blue); border-radius: 3px; transition: width .3s; }

/* ── LOADING ─────────────────────────────────────────────────── */
.loading-spin {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ZONE MODAL INNER ────────────────────────────────────────── */
.zone-modal-inner { display: flex; flex-direction: column; gap: 0; }


/* ── LOGOS ──────────────────────────────────────────────────── */
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}
.login-logo-img {
  width: 220px;
  height: auto;
  object-fit: contain;
}
.logo-sub-login {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  letter-spacing: .4px;
  text-align: center;
}
.nav-logo-img {
  height: 42px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  display: block;
  background: #fff;
  border-radius: 6px;
  padding: 3px 6px;
  filter: none !important;
}
.nav-logo { padding: 2px 0; flex-shrink: 0; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .main-content { padding: 16px 12px 60px; }
  .page-header { flex-direction: column; }
  .page-title { font-size: 22px; }
  .field-row { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .rc-actions { gap: 6px; }
  .navbar { padding: 0 14px; }
  .nav-logo-img { height: 40px; max-width: 122px; padding: 3px 5px; }
  .nav-user { display: none; }
  .map-section-label { height: 60px; font-size: 7px; } /* shorter on mobile */
  .zone-btn, .zone-empty { width: 30px; height: 30px; }
  .zone-btn { font-size: 10px; }
}

@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }
  .zone-grid { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); }
}

/* ── FOOTER ──────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 18px 20px 24px;
  font-size: 12px;
  color: var(--gray-3);
  margin-top: 40px;
  border-top: 1px solid var(--gray-2);
}
.app-footer a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  transition: color .2s;
}
.app-footer a:hover { color: var(--navy); text-decoration: underline; }

/* Login footer brand */
.login-brand {
  margin-top: 16px;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,.4);
}
.login-brand a { color: rgba(255,255,255,.6); text-decoration: none; }
.login-brand a:hover { color: #fff; }

/* ── DOCUMENTOS ADJUNTOS DEL INFORME MENSUAL ────────────────── */
.documents-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 20px;
}
.documents-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.documents-sub {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.45;
  margin-top: 4px;
}
.document-upload-box {
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: #fbfcfe;
  margin-bottom: 16px;
}
.documents-list {
  display: grid;
  gap: 10px;
}
.document-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-sm);
  background: #fff;
}
.document-icon {
  width: 44px;
  height: 36px;
  border-radius: 8px;
  background: var(--blue-xl);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.document-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.document-info strong {
  color: var(--navy);
  font-size: 14px;
}
.document-info span {
  color: var(--text-2);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.no-documents-msg {
  color: var(--gray-4);
  font-size: 13px;
  font-style: italic;
  padding: 6px 0;
}
@media (max-width: 620px) {
  .documents-panel { padding: 16px; }
  .document-upload-box .field-row { grid-template-columns: 1fr; }
  .document-item { align-items: flex-start; }
}

/* ── PANEL DE ACTIVIDADES DEL INFORME MENSUAL ────────────────── */
.monthly-panel,
.activity-validation-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
}
.monthly-panel-head,
.activity-validation-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.monthly-activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.monthly-activity-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-decoration: none;
  color: var(--text);
  border: 1.5px solid var(--gray-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fff;
  transition: border-color .2s, box-shadow .2s, transform .1s;
}
.monthly-activity-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.monthly-activity-card.active {
  border-color: var(--blue);
  background: var(--blue-xl);
}
.monthly-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.monthly-type,
.monthly-current {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .35px;
  border-radius: 999px;
  padding: 3px 7px;
}
.monthly-type { background: var(--gray-2); color: var(--text-2); }
.monthly-current { background: var(--blue); color: #fff; }
.monthly-activity-card strong {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 17px;
  color: var(--navy);
  line-height: 1.1;
  text-transform: uppercase;
}
.monthly-activity-card small,
.monthly-activity-card em {
  font-size: 12px;
  color: var(--text-2);
  font-style: normal;
}
.mini-progress {
  height: 5px;
  background: var(--gray-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.mini-progress span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 999px;
}
.add-monthly-form {
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  padding: 16px;
}
.form-inline-title {
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 12px;
}
.activity-add-row { margin-bottom: 12px; }
.monthly-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.form-hint {
  color: var(--text-2);
  font-size: 12px;
}
.activity-validation-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--gray-1);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  color: var(--text-2);
}
.activity-validation-summary strong {
  color: var(--blue);
  font-size: 24px;
  line-height: 1;
}
.empty-evidence-box {
  text-align: center;
  padding: 36px 18px;
  border: 1.5px dashed var(--gray-3);
  border-radius: var(--radius-sm);
  color: var(--text-2);
}
.empty-evidence-box h3 {
  color: var(--navy);
  margin-bottom: 6px;
}
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.evidence-card {
  text-align: left;
  border: 1.5px solid var(--gray-2);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  font-family: 'Barlow', sans-serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 126px;
  transition: border-color .2s, box-shadow .2s, transform .1s;
}
.evidence-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.evidence-card.done {
  border-color: rgba(67,160,71,.55);
  background: #fbfffb;
}
.evidence-number {
  width: fit-content;
  border-radius: 999px;
  background: var(--gray-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
}
.evidence-card.done .evidence-number {
  background: var(--green-l);
  color: #1B5E20;
}

.evidence-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.evidence-delete-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: rgba(229, 57, 53, .1);
  color: var(--danger);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s, transform .1s;
}
.evidence-delete-btn:hover {
  background: var(--danger);
  color: #fff;
  transform: scale(1.05);
}
.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--danger);
  background: #fff;
  color: var(--danger);
  font-weight: 800;
  font-family: 'Barlow', sans-serif;
  cursor: pointer;
}
.btn-danger-outline:hover {
  background: var(--danger);
  color: #fff;
}
.evidence-modal-footer {
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .evidence-modal-footer button {
    width: 100%;
  }
}
.evidence-card strong { color: var(--navy); }
.evidence-card small,
.evidence-card em,
.evidence-card p {
  color: var(--text-2);
  font-size: 12px;
  font-style: normal;
}
.activity-evidence-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--gray-1);
}
.activity-evidence-heading strong {
  color: var(--navy);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  text-transform: uppercase;
}
.activity-evidence-heading span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
@media (max-width: 720px) {
  .monthly-panel,
  .activity-validation-panel { padding: 16px; }
  .monthly-panel-head,
  .activity-validation-head { flex-direction: column; align-items: stretch; }
  .activity-add-row { grid-template-columns: 1fr; }
  .monthly-activity-grid,
  .evidence-grid { grid-template-columns: 1fr; }
  .monthly-form-actions .btn-primary,
  .activity-validation-head .btn-primary { width: 100%; justify-content: center; }
}

/* ── AJUSTE LOGIN RESPONSIVO ──────────────────────────────────
   Mantiene el login compacto en escritorio y más ancho/profesional
   únicamente en pantallas móviles.
---------------------------------------------------------------- */
.login-page {
  overflow-x: hidden;
}

.login-page .login-wrap {
  max-width: 420px;
  width: min(92vw, 420px);
  padding: 20px;
}

.login-page .login-card {
  width: 100%;
  border-radius: 16px;
  padding: 38px 34px 32px;
}

.login-page .login-logo {
  margin-bottom: 26px;
}

.login-page .login-logo-img {
  width: 220px;
  max-width: 82%;
}

.login-page .login-subtitle {
  font-size: 14px;
  line-height: 1.35;
  margin-bottom: 22px;
}

.login-page .login-form {
  gap: 15px;
}

.login-page .login-form .field-group input {
  min-height: 46px;
  font-size: 15px;
}

.login-page .login-form .btn-full {
  min-height: 48px;
  font-size: 15px;
}

.login-page .login-footer {
  margin-top: 18px;
  font-size: 12px;
}

.login-signature {
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  color: #9aa8b4;
}

.login-signature a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.login-signature a:hover {
  color: var(--navy);
  text-decoration: underline;
}

.login-brand {
  display: none;
}

@media (max-width: 640px) {
  .login-page {
    align-items: center;
  }

  .login-page .login-wrap {
    width: 94vw;
    max-width: 520px;
    padding: 16px 12px;
  }

  .login-page .login-card {
    padding: 40px 34px 34px;
    border-radius: 20px;
  }

  .login-page .login-logo {
    margin-bottom: 28px;
  }

  .login-page .login-logo-img {
    width: min(70vw, 305px);
    max-width: 100%;
  }

  .login-page .login-subtitle {
    font-size: 16px;
    margin-bottom: 28px;
  }

  .login-page .login-form {
    gap: 18px;
  }

  .login-page .login-form .field-group label {
    font-size: 15px;
    font-weight: 700;
  }

  .login-page .login-form .field-group input {
    min-height: 56px;
    border-radius: 10px;
    padding: 13px 16px;
    font-size: 17px;
  }

  .login-page .login-form .btn-full {
    min-height: 56px;
    border-radius: 10px;
    font-size: 17px;
  }

  .login-page .login-footer {
    margin-top: 22px;
    font-size: 14px;
  }

  .login-signature {
    font-size: 13px;
    margin-top: 8px;
  }
}

@media (max-width: 390px) {
  .login-page .login-wrap {
    width: 95vw;
    padding: 12px 10px;
  }

  .login-page .login-card {
    padding: 34px 24px 30px;
    border-radius: 18px;
  }

  .login-page .login-logo-img {
    width: min(72vw, 285px);
  }

  .login-page .login-subtitle {
    font-size: 16px;
    margin-bottom: 26px;
  }

  .login-page .login-form .field-group input,
  .login-page .login-form .btn-full {
    min-height: 56px;
    font-size: 17px;
  }
}


/* ================================================================
   LAPSO 18 · SERVIALPA — v2 Styles (Módulos 2, 3 y 4)
   Home page, module cards, new form elements
================================================================ */

/* ── DUAL LOGO NAVBAR ──────────────────────────────────────────── */
.nav-logo-sep {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,.2);
  margin: 0 4px;
}
.nav-logo-servialpa {
  height: 34px;
  max-width: 100px;
  border-radius: 4px;
  padding: 2px 4px;
  background: #fff;
}
.nav-link-active { color: #fff !important; font-weight: 600; }
.nav-link svg { vertical-align: middle; margin-right: 3px; }

/* ── LOGIN DUAL LOGOS ──────────────────────────────────────────── */
.login-logo { display: flex; justify-content: center; align-items: center; gap: 14px; margin-bottom: 8px; }
.login-logo-lapso { width: 130px; height: auto; object-fit: contain; }
.login-logo-serv  { height: 54px; width: auto; max-width: 130px; object-fit: contain; border-radius: 6px; border: 1px solid var(--gray-2); padding: 4px 6px; }

/* ── HOME PAGE ─────────────────────────────────────────────────── */
.home-header { align-items: center; }
.home-welcome { font-size: 14px; color: var(--text-2); }
.home-welcome strong { color: var(--text); }

.home-modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 8px;
}

.module-card {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-lg);
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}
.module-card:hover { transform: translateY(-4px); box-shadow: 0 16px 48px rgba(13,27,42,.22); }

.module-card-blue  { background: linear-gradient(145deg, #1565C0, #0D47A1); }
.module-card-green { background: linear-gradient(145deg, #2E7D32, #1B5E20); }
.module-card-steel { background: linear-gradient(145deg, #455A64, #263238); }
.module-card-gold  { background: linear-gradient(145deg, #E65100, #BF360C); }

.mc-icon {
  padding: 28px 28px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc-icon svg { width: 72px; height: 72px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }

.mc-content { padding: 18px 28px 12px; flex: 1; }
.mc-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  margin-bottom: 6px;
}
.mc-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.mc-desc { font-size: 13px; color: rgba(255,255,255,.75); line-height: 1.55; }

.mc-footer {
  padding: 14px 28px 22px;
  display: flex;
  align-items: center;
}
.mc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.25);
  transition: background .2s;
}
.module-card:hover .mc-btn { background: rgba(255,255,255,.3); }

/* ── BREADCRUMB ────────────────────────────────────────────────── */
.module-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
}
.module-breadcrumb a { color: var(--blue); text-decoration: none; }
.module-breadcrumb a:hover { text-decoration: underline; }
.module-breadcrumb svg { color: var(--gray-3); }

/* ── PAGE HEADER ICON ──────────────────────────────────────────── */
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.module-icon-green { background: #E8F5E9; color: #2E7D32; }
.module-icon-steel { background: #ECEFF1; color: #455A64; }
.module-icon-gold  { background: #FBE9E7; color: #E65100; }

/* ── MODULE-COLORED BUTTONS ────────────────────────────────────── */
.btn-green  { background: #2E7D32 !important; }
.btn-green:hover { background: #1B5E20 !important; }
.btn-steel  { background: #455A64 !important; }
.btn-steel:hover { background: #263238 !important; }
.btn-gold   { background: #E65100 !important; }
.btn-gold:hover { background: #BF360C !important; }

.btn-green-sm, .btn-steel-sm, .btn-gold-sm {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: background .2s;
}
.btn-green-sm { background: #E8F5E9; color: #2E7D32; }
.btn-green-sm:hover { background: #C8E6C9; }
.btn-steel-sm { background: #ECEFF1; color: #455A64; }
.btn-steel-sm:hover { background: #CFD8DC; }
.btn-gold-sm  { background: #FBE9E7; color: #E65100; }
.btn-gold-sm:hover { background: #FFCCBC; }

/* ── REPORT CARD VARIANTS ──────────────────────────────────────── */
.report-card-green .rc-badge, .report-card-green .rc-title { color: #2E7D32; }
.report-card-green .rc-progress .progress-fill { background: #2E7D32; }
.report-card-steel .rc-badge, .report-card-steel .rc-title { color: #455A64; }
.report-card-gold .rc-badge, .report-card-gold .rc-title { color: #E65100; }

.rc-stats { display: flex; gap: 12px; margin: 6px 0 10px; flex-wrap: wrap; }
.rc-stat { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.rc-stat svg { color: var(--gray-3); }
.rc-stat-gold { background: #FBE9E7; color: #E65100; padding: 2px 8px; border-radius: 10px; font-weight: 600; }

.pres-number {
  display: inline-block; font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px; font-weight: 700; color: #E65100;
  letter-spacing: .5px; margin-bottom: 4px;
}

/* ── CARD VARIANTS ─────────────────────────────────────────────── */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px; font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px; font-weight: 700; letter-spacing: .5px;
  border-bottom: 1px solid var(--gray-2);
}
.card-header svg { flex-shrink: 0; }
.card-header-green { background: #E8F5E9; color: #1B5E20; border-bottom-color: #C8E6C9; }
.card-header-steel { background: #ECEFF1; color: #263238; border-bottom-color: #CFD8DC; }
.card-header-gold  { background: #FBE9E7; color: #BF360C; border-bottom-color: #FFCCBC; }
.card-body  { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--gray-2); display: flex; gap: 10px; align-items: center; background: var(--gray-1); }
.p-0 { padding: 0 !important; }

/* ── EDIT LAYOUT ───────────────────────────────────────────────── */
.edit-layout { display: flex; gap: 20px; }
.edit-main { flex: 1; min-width: 0; }

/* ── INLINE INPUTS (activity / item editing) ───────────────────── */
.inline-input {
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: 'Barlow', sans-serif;
  color: var(--text);
  background: #fff;
  width: 100%;
  transition: border-color .2s;
}
.inline-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(21,101,192,.1); }
.inline-input.flex-1 { flex: 1; }
.inline-input.fw-500 { font-weight: 500; }
.inline-input.fw-600 { font-weight: 600; }
.inline-input.text-center { text-align: center; }
.inline-input.text-right  { text-align: right; }
.mt-1 { margin-top: 6px; }
.flex-1 { flex: 1; }

/* ── ACTIVITY BLOCKS (Module 2) ─────────────────────────────────── */
.activity-block {
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  background: var(--gray-1);
}
.activity-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.activity-header-left { display: flex; flex: 1; gap: 8px; align-items: center; }
.activity-header .act-date { width: 150px; flex-shrink: 0; }
.act-desc { resize: vertical; }

.photo-upload-area { margin-top: 10px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.photo-thumb {
  position: relative;
  width: 110px;
}
.photo-thumb img { width: 110px; height: 80px; object-fit: cover; border-radius: 6px; display: block; }
.photo-caption { width: 100%; font-size: 11px; padding: 3px 5px; margin-top: 3px; border: 1px solid var(--gray-2); border-radius: 3px; }
.photo-delete {
  position: absolute; top: 3px; right: 3px;
  background: rgba(229,57,53,.85); color: #fff; border: none;
  border-radius: 50%; width: 18px; height: 18px;
  font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.photo-upload-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius-sm);
  background: #fff; border: 1.5px dashed var(--gray-3);
  color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.photo-upload-btn:hover { border-color: var(--blue); background: var(--blue-xl); color: var(--blue); }
.photo-upload-status { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.empty-activities { text-align: center; padding: 24px; color: var(--text-2); }
.empty-activities svg { display: block; margin: 0 auto 10px; opacity: .4; }
.empty-activities p { font-size: 14px; }

/* ── PUNTO BLOCKS (Module 3) ────────────────────────────────────── */
.punto-block {
  border: 1px solid #CFD8DC;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  background: #FAFAFA;
}
.punto-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.punto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.punto-input-group { display: flex; flex-direction: column; gap: 4px; }
.punto-input-group label { font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; }
.calc-badge {
  background: #ECEFF1; border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 15px; font-weight: 700;
  color: #455A64; font-family: 'Barlow Condensed', sans-serif;
  text-align: center;
}
.calc-hint { font-size: 10px; color: var(--gray-3); font-style: italic; }
.empty-puntos-msg { text-align: center; padding: 20px; color: var(--text-2); font-size: 14px; }

/* ── ITEMS TABLE (Module 4) ─────────────────────────────────────── */
.items-table-head {
  display: grid;
  grid-template-columns: 44px 1fr 100px 70px 70px 90px 80px 36px;
  gap: 0;
  background: var(--navy);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 8px 12px;
}
.items-table-head > div { display: flex; align-items: center; padding: 0 4px; }

.item-row {
  display: grid;
  grid-template-columns: 44px 1fr 100px 70px 70px 90px 80px 36px;
  gap: 0;
  border-bottom: 1px solid var(--gray-2);
  padding: 8px 12px;
  align-items: start;
}
.item-row:nth-child(even) { background: var(--gray-1); }

.itcol-item, .itcol-und, .itcol-cant, .itcol-precio, .itcol-total, .itcol-del { padding: 2px 4px; }
.itcol-desc, .itcol-dim { padding: 2px 8px 2px 4px; }
.itcol-item { display: flex; align-items: center; justify-content: center; font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 16px; color: var(--navy); }
.dim-inputs { display: flex; align-items: center; gap: 4px; }
.dim-x { font-size: 11px; color: var(--gray-3); }
.item-total-display { font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 700; color: var(--navy); white-space: nowrap; }

.totals-block {
  padding: 16px 20px;
  border-top: 2px solid var(--gray-2);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.total-line {
  display: flex;
  gap: 40px;
  font-size: 13px;
  width: 280px;
  justify-content: space-between;
}
.itbms-line { color: var(--text-2); }
.total-final-line {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  border-top: 2px solid var(--navy);
  padding-top: 6px;
  margin-top: 2px;
}

.itbms-check { font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.empty-items-msg { padding: 20px; text-align: center; color: var(--text-2); font-size: 14px; }

/* ── SHARED UI ELEMENTS ─────────────────────────────────────────── */
.btn-sm-icon {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.8); border: 1px solid currentColor;
  font-size: 12px; font-weight: 600; cursor: pointer; color: inherit;
  font-family: 'Barlow', sans-serif; transition: background .2s;
  margin-left: auto;
}
.btn-sm-icon:hover { background: rgba(255,255,255,1); }
.ml-auto { margin-left: auto; }

.btn-danger-icon {
  background: none; border: none; cursor: pointer;
  color: var(--danger); padding: 4px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.btn-danger-icon:hover { background: #FFEBEE; }

.alert-success {
  background: #E8F5E9; border: 1px solid #A5D6A7; color: #1B5E20;
  border-radius: var(--radius-sm); padding: 10px 16px; font-weight: 600;
  font-size: 14px; margin-bottom: 16px;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: var(--gray-2); color: var(--text-2); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 12px; text-align: left; border: 1px solid var(--gray-2); }
.data-table td { padding: 7px 12px; border: 1px solid var(--gray-2); }
.total-row td { font-weight: 700; background: var(--gray-1); font-family: 'Barlow Condensed', sans-serif; font-size: 14px; }

.form-footer-bar {
  position: sticky; bottom: 0; z-index: 50;
  background: #fff; border-top: 1px solid var(--gray-2);
  padding: 14px 20px; display: flex; align-items: center;
  gap: 12px; justify-content: flex-end;
  box-shadow: 0 -4px 16px rgba(13,27,42,.1);
  margin-top: 8px;
}

/* ── RESPONSIVE HOME ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .home-modules-grid { grid-template-columns: 1fr; gap: 16px; }
  .mc-title { font-size: 22px; }
  .punto-grid { grid-template-columns: repeat(2, 1fr); }
  .items-table-head, .item-row {
    grid-template-columns: 30px 1fr 60px 50px 60px 80px;
  }
  .itcol-dim, .itcol-del { display: none; }
}

/* ================================================================
   LAPSO18 · SERVIALPA — V3 production hardening
================================================================ */
.module-breadcrumb span { color: var(--text-2); }
.materials-grid-v3 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 16px;
}
.punto-block {
  border: 1px solid var(--gray-2);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  background: #fff;
  box-shadow: 0 1px 5px rgba(13,27,42,.05);
}
.punto-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.punto-head strong {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.module-photo-thumb {
  width: 130px;
  height: 92px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: var(--gray-2);
  border: 1px solid var(--gray-2);
  margin: 6px 0 10px;
}
.module-photo-thumb.large { width: 230px; height: 140px; }
.module-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.remove-photo-check {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  background: rgba(13,27,42,.82);
  color: #fff;
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.form-footer-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--gray-2);
  padding: 14px 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  backdrop-filter: blur(10px);
}
.total-row td { font-weight: 800; }
.btn-steel-sm { background: #455A64; color: #fff; border-radius: 8px; padding: 7px 12px; text-decoration: none; font-weight: 700; font-size: 13px; }
.btn-green-sm { background: #2E7D32; color: #fff; border-radius: 8px; padding: 7px 12px; text-decoration: none; font-weight: 700; font-size: 13px; }
.btn-gold-sm { background: #E65100; color: #fff; border-radius: 8px; padding: 7px 12px; text-decoration: none; font-weight: 700; font-size: 13px; }
@media (max-width: 900px) { .materials-grid-v3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .materials-grid-v3 { grid-template-columns: 1fr; } .form-footer-bar { position: static; flex-wrap: wrap; } .module-photo-thumb.large { width: 100%; height: 180px; } }

/* ================================================================
   Ajuste 26.05.2026 — Presupuestos en móviles
   Mejora lectura del ítem, descripción, unidad, cantidad y precio
   cuando el teléfono está en vertical.
================================================================ */
@media (max-width: 768px) {
  .items-table-head {
    display: none !important;
  }
  .item-row {
    display: grid !important;
    grid-template-columns: 38px 1fr 1fr !important;
    grid-template-areas:
      "num desc desc"
      "num und cant"
      "num precio total"
      "num del del";
    gap: 10px !important;
    align-items: stretch !important;
    padding: 14px !important;
    margin: 12px;
    border: 1px solid var(--gray-2);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(13,27,42,.06);
  }
  .item-row:nth-child(even) { background: #fff; }
  .item-row .itcol-item { grid-area: num; align-items: flex-start; padding-top: 8px; }
  .item-row .itcol-desc { grid-area: desc; padding: 0; min-width: 0; }
  .item-row .itcol-dim { display: none !important; }
  .item-row .itcol-und { grid-area: und; padding: 0; min-width: 0; }
  .item-row .itcol-cant { grid-area: cant; padding: 0; min-width: 0; }
  .item-row .itcol-precio { grid-area: precio; padding: 0; min-width: 0; }
  .item-row .itcol-total { grid-area: total; padding: 0; display: flex; align-items: center; justify-content: flex-end; min-width: 0; }
  .item-row .itcol-del { grid-area: del; padding: 0; display: flex; justify-content: flex-end; }
  .item-row .itcol-desc::before,
  .item-row .itcol-und::before,
  .item-row .itcol-cant::before,
  .item-row .itcol-precio::before,
  .item-row .itcol-total::before {
    display: block;
    margin: 0 0 4px;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-2);
  }
  .item-row .itcol-desc::before { content: 'Descripción'; }
  .item-row .itcol-und::before { content: 'Unidad'; }
  .item-row .itcol-cant::before { content: 'Cantidad'; }
  .item-row .itcol-precio::before { content: 'P. Unitario'; }
  .item-row .itcol-total::before { content: 'Total'; margin-right: auto; }
  .item-row .inline-input,
  .item-row select,
  .item-row textarea {
    min-height: 44px;
    font-size: 15px;
  }
  .item-row textarea[name="item_desc[]"] {
    min-height: 104px;
    resize: vertical;
    line-height: 1.35;
  }
  .item-total-display {
    font-size: 20px;
  }
}

@media (max-width: 420px) {
  .item-row {
    grid-template-columns: 34px 1fr !important;
    grid-template-areas:
      "num desc"
      "num und"
      "num cant"
      "num precio"
      "num total"
      "num del";
  }
  .item-row .itcol-total { justify-content: flex-start; }
}

/* =========================================================
   Gestión de perfiles y permisos — Patch usuarios 26.05.2026
   ========================================================= */
.module-card-purple { background: linear-gradient(135deg, #3B245F 0%, #6D3FA0 100%); }
.module-icon-purple { background: linear-gradient(135deg, #3B245F 0%, #6D3FA0 100%); color: #fff; }
.btn-purple { background: linear-gradient(135deg, #3B245F 0%, #6D3FA0 100%) !important; border-color: #6D3FA0 !important; color: #fff !important; }
.admin-note {
  background: #fff;
  border: 1px solid rgba(59,36,95,.14);
  border-left: 5px solid #6D3FA0;
  border-radius: 16px;
  padding: 16px 18px;
  color: #3c4655;
  margin-bottom: 18px;
  box-shadow: 0 12px 30px rgba(16,32,51,.06);
}
.users-table-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 18px 45px rgba(16,32,51,.08);
  overflow: hidden;
  border: 1px solid rgba(16,32,51,.08);
}
.users-table-scroll { overflow-x: auto; }
.users-table { width: 100%; border-collapse: collapse; min-width: 920px; }
.users-table th {
  background: #071727;
  color: #fff;
  text-align: left;
  padding: 15px 16px;
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 15px;
}
.users-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(16,32,51,.08);
  vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: none; }
.row-muted { opacity: .58; }
.muted-text { color: #758194; font-size: 13px; }
.role-pill, .status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.role-admin { background: #efe6ff; color: #4b247c; }
.role-field_supervisor { background: #e8f5e9; color: #1b6f35; }
.role-document_manager { background: #e8f0ff; color: #194a9d; }
.role-inspector { background: #fff4e5; color: #9b4d00; }
.status-active { background: #e8f5e9; color: #1b6f35; }
.status-inactive { background: #f2f3f5; color: #6b7280; }
.module-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.module-tags span {
  background: #f0f4f8;
  color: #314155;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
}
.users-actions { white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.user-form-card { max-width: 980px; }
.user-active-check { margin-top: 6px; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: #263445; }
.form-section-title {
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #102033;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 14px;
}
.form-help { color: #64748b; margin-top: -6px; margin-bottom: 14px; }
.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.permission-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  padding: 16px;
  border: 1px solid rgba(16,32,51,.12);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  transition: .18s ease;
}
.permission-card:hover { border-color: #6D3FA0; box-shadow: 0 10px 24px rgba(16,32,51,.08); }
.permission-card input { grid-row: 1 / span 2; margin-top: 3px; width: 18px; height: 18px; }
.permission-title { font-weight: 800; color: #102033; }
.permission-desc { color: #64748b; font-size: 13px; line-height: 1.35; }
.permissions-admin-mode .permission-card { opacity: .72; background: #f7f5fb; }
.mt-3 { margin-top: 28px; }
.alert-success {
  background: #e8f5e9;
  color: #1b6f35;
  border: 1px solid rgba(27,111,53,.18);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-weight: 600;
}
@media (max-width: 760px) {
  .permissions-grid { grid-template-columns: 1fr; }
  .users-table { min-width: 760px; }
  .users-actions { flex-direction: column; align-items: flex-start; }
}

/* Patch móvil: input nativo accesible para seleccionar/tomar fotos y visor ampliado */
.file-input-native {
  position: fixed !important;
  left: -9999px !important;
  top: 0 !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}
.photo-item img { cursor: zoom-in; }
.photo-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(4, 16, 28, .94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.photo-lightbox-img {
  max-width: 96vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 20px 55px rgba(0,0,0,.45);
  background: #fff;
}
.photo-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0b1d2b;
  font-size: 34px;
  line-height: 42px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
@media (max-width: 640px) {
  .photo-lightbox-overlay { padding: 10px; }
  .photo-lightbox-img { max-width: 98vw; max-height: 86vh; border-radius: 10px; }
}
