/* Tema iOS: mobile-first, apariencia nativa sobre el markup Bootstrap existente. */
:root {
  --guinda:        #6b1a2a;
  --guinda-dark:   #4a1020;
  --ios-bg:        #f2f2f7;
  --ios-sep:       rgba(60, 60, 67, .18);
  --ios-secondary: #6c6c70;
  --ios-gris:      #8e8e93;
  --ios-verde:     #34c759;
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--ios-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #1c1c1e;
}

/* ---- Barra superior translúcida ---- */
.ios-topbar {
  position: sticky; top: 0; z-index: 1030;
  background: rgba(242, 242, 247, .82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--ios-sep);
  padding-top: env(safe-area-inset-top);
}
.ios-topbar .bar {
  position: relative; height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem; max-width: 1100px; margin: 0 auto;
}
.ios-topbar .titulo {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 17px; font-weight: 600; white-space: nowrap;
  max-width: 55%; overflow: hidden; text-overflow: ellipsis;
}
.ios-topbar .marca { font-size: 15px; font-weight: 700; color: var(--guinda); letter-spacing: -.2px; }
.mr-contexto {
  background: rgba(184, 149, 106, .16);
  border-top: .5px solid var(--ios-sep);
  padding: 5px 12px;
  font-size: 13px; color: #6e5637;
}
.mr-contexto .form-select-sm { font-size: 13px; min-height: 30px; padding-top: 2px; padding-bottom: 2px; }

.avatar-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: var(--guinda); color: #fff;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Contenido ---- */
.ios-main {
  max-width: 1100px; margin: 0 auto;
  padding: 1rem 1rem calc(86px + env(safe-area-inset-bottom));
}
.ios-main h1.h4, .ios-main h1.h5 {
  font-size: 28px; font-weight: 700; letter-spacing: -.4px;
}

/* ---- Tarjetas estilo inset-grouped ---- */
.card { border: 0; border-radius: 14px; }
.card .card-header {
  background: #fff !important; border-bottom: .5px solid var(--ios-sep);
  border-radius: 14px 14px 0 0 !important; font-size: 15px;
}
.card .card-footer { border-top: .5px solid var(--ios-sep); border-radius: 0 0 14px 14px !important; }
.shadow-sm { box-shadow: 0 1px 3px rgba(0, 0, 0, .07) !important; }
.list-group-item { border-color: var(--ios-sep); padding-top: .7rem; padding-bottom: .7rem; }

/* ---- Controles táctiles ---- */
.form-control, .form-select {
  border-radius: 10px; min-height: 44px;
  border-color: rgba(60, 60, 67, .24); font-size: 16px;
}
.form-control-sm, .form-select-sm { min-height: 36px; font-size: 14px; }
.form-control:focus, .form-select:focus {
  border-color: var(--guinda); box-shadow: 0 0 0 3px rgba(107, 26, 42, .14);
}
.form-label { font-size: 13px; font-weight: 600; color: var(--ios-secondary); text-transform: uppercase; letter-spacing: .3px; }
.btn { border-radius: 10px; }
.btn-guinda { min-height: 44px; font-weight: 600; font-size: 16px; }
.btn-sm { min-height: auto; font-size: 14px; }
/* El switch iOS es más ancho que el de Bootstrap: se amplía el espacio
   reservado para que no invada la etiqueta. */
.form-switch { padding-left: 3.3em; }
.form-switch .form-check-input { height: 1.45em; width: 2.6em; margin-left: -3.3em; }
.form-switch .form-check-input:checked { background-color: var(--ios-verde); border-color: var(--ios-verde); }
.form-switch .form-check-label { padding-top: .1em; }
/* Switch suelto (sin etiqueta a su derecha): no necesita reservar ese espacio. */
.form-switch.sin-etiqueta { padding-left: 0; }
.form-switch.sin-etiqueta .form-check-input { margin-left: 0; }
.badge { border-radius: 20px; font-weight: 600; }

/* ---- Tablas ---- */
.table { font-size: .9rem; }
.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .4px;
  color: var(--ios-secondary); font-weight: 600; background: #fff;
}

/* ---- Tab bar inferior ---- */
.ios-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  display: flex;
  background: rgba(249, 249, 249, .85);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--ios-sep);
  padding-bottom: env(safe-area-inset-bottom);
}
.ios-tabbar a {
  flex: 1; text-align: center; padding: 7px 0 5px;
  text-decoration: none; color: var(--ios-gris);
  font-size: 10px; line-height: 1.2; font-weight: 500;
}
.ios-tabbar a i { display: block; font-size: 22px; margin-bottom: 2px; }
.ios-tabbar a.activo { color: var(--guinda); }
@media (min-width: 768px) {
  .ios-tabbar {
    left: 50%; right: auto; bottom: 14px; transform: translateX(-50%);
    width: 580px; border-radius: 26px;
    border: .5px solid var(--ios-sep);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .14);
    padding-bottom: 0;
  }
}

/* ---- Breadcrumbs ---- */
.migas {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  font-size: 14px; color: var(--ios-secondary);
}
.migas a { color: var(--guinda); text-decoration: none; font-weight: 500; }
.migas a:active { opacity: .6; }
.migas .sep { font-size: 11px; color: var(--ios-gris); }
.migas span { color: var(--ios-secondary); }

/* ---- Directorio ---- */
.dir-foto {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.dir-ini {
  background: var(--guinda); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 17px;
}
.dir-accion {
  width: 38px; height: 38px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}

/* ---- Botón flotante de creación (solo móvil) ---- */
.fab {
  position: fixed; right: 16px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 1029;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--guinda); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; text-decoration: none;
  box-shadow: 0 6px 16px rgba(107, 26, 42, .45);
}
.fab:hover, .fab:active { background: var(--guinda-dark); color: #fff; }
@media (min-width: 768px) { .fab { display: none; } }

/* ---- Hoja inferior (Más) ---- */
.ios-sheet { border-radius: 16px 16px 0 0; --bs-offcanvas-height: auto; }
.ios-sheet .offcanvas-body { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
.ios-sheet .list-group-item { font-size: 16px; }
.ios-sheet .list-group { border-radius: 12px; overflow: hidden; }

.min-w-0 { min-width: 0; }

/* ---- Línea de tiempo de seguimiento ---- */
.linea-tiempo { position: relative; padding-left: 22px; }
.linea-tiempo::before {
  content: ''; position: absolute; left: 5px; top: 8px; bottom: 8px;
  width: 2px; background: var(--ios-sep); border-radius: 1px;
}
.lt-item { position: relative; padding-bottom: 1.15rem; }
.lt-item::before {
  content: ''; position: absolute; left: -22px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--guinda); border: 2.5px solid #fff;
  box-shadow: 0 0 0 1px var(--ios-sep);
}
.lt-item.origen::before { background: var(--ios-gris); }
.lt-item.cierre::before { background: var(--ios-verde); }
.lt-fecha { font-size: 12px; color: var(--ios-secondary); }
.adjuntos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.adjuntos img {
  width: 74px; height: 74px; object-fit: cover;
  border-radius: 10px; border: .5px solid var(--ios-sep);
}
.evidencia-item { position: relative; display: inline-flex; }
.evidencia-item .borrar-evidencia { position: absolute; top: -6px; right: -6px; }
.evidencia-item .borrar-evidencia button {
  width: 24px; height: 24px; padding: 0; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.adjunto-pdf {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: #fff;
  border: .5px solid var(--ios-sep); border-radius: 10px;
  font-size: 13px; text-decoration: none; color: #1c1c1e;
}

/* ---- Login ---- */
.login-bg .card { border-radius: 18px; }
