/* =====================================================
   Montero Campo — Diseño profesional mobile-first v2
   ===================================================== */

:root {
  --primary: #1E40AF;
  --primary-light: #3B82F6;
  --primary-dark: #1e3a8a;
  --primary-50: #EFF6FF;
  --success: #10B981;
  --success-light: #D1FAE5;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --info: #06B6D4;
  --purple: #7C3AED;
  --purple-light: #EDE9FE;
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --text: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --tab-height: 64px;
  --header-height: 60px;
  --transition: 0.2s ease;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-top: calc(var(--header-height) + env(safe-area-inset-top));
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}

/* ── Status bar (offline) ─────────────────────────── */
.status-bar {
  position: fixed;
  top: calc(var(--header-height) + env(safe-area-inset-top));
  left: 0; right: 0;
  z-index: 199;
  background: var(--warning);
  color: #fff;
  padding: .5rem 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
  font-weight: 600;
  animation: slideDown .3s ease;
}
.status-bar.hidden { display: none !important; }
@keyframes slideDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

/* ── Page header ──────────────────────────────────── */
.page-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  padding: 1rem;
  position: sticky;
  top: calc(var(--header-height) + env(safe-area-inset-top));
  z-index: 100;
  box-shadow: 0 2px 10px rgba(30,64,175,.3);
}

.page-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: -.01em;
}

.page-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}

.page-header-captura {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1rem;
}

.page-header-captura h2 { font-size: 1rem; margin-bottom: .125rem; }
.page-header-info { flex: 1; min-width: 0; }
.header-subtitle {
  font-size: .78rem;
  opacity: .85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-back {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition);
  backdrop-filter: blur(4px);
}
.btn-back:active { background: rgba(255,255,255,.35); }

.online-indicator {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background var(--transition);
}
.online-indicator.offline { background: rgba(239,68,68,.4); }

/* ── Search box ───────────────────────────────────── */
.search-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  padding: .5rem .875rem;
  margin-bottom: .75rem;
  border: 1px solid rgba(255,255,255,.2);
  backdrop-filter: blur(4px);
}
.search-box input {
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: .9rem;
  width: 100%;
  font-family: inherit;
}
.search-box input::placeholder { color: rgba(255,255,255,.65); }
.search-box i { color: rgba(255,255,255,.8); font-size: .9rem; }

/* ── Filter tabs ──────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: .375rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  flex-shrink: 0;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.9);
  padding: .3rem .75rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.filter-tab.active {
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  border-color: #fff;
}

/* ── Main content ─────────────────────────────────── */
.main-content { padding: 0; }

/* ── Orden cards ──────────────────────────────────── */
.ordenes-list {
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .625rem;
}

.orden-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.orden-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--primary-light);
  border-radius: 4px 0 0 4px;
}
.orden-card.estado-finalizado::before { background: var(--success); }
.orden-card.estado-proceso::before { background: var(--warning); }
.orden-card.estado-cancelado::before { background: var(--danger); }
.orden-card:active { transform: scale(.985); box-shadow: var(--shadow-md); }

.orden-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
  padding-left: .5rem;
}
.orden-ref {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  letter-spacing: -.01em;
}

.orden-card-body {
  margin-bottom: .5rem;
  padding-left: .5rem;
}
.orden-cliente {
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--text);
}
.orden-empresa, .orden-direccion {
  font-size: .78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .2rem;
}
.orden-empresa i, .orden-direccion i { font-size: .7rem; opacity: .7; }

.orden-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border-light);
  padding-left: .5rem;
}
.orden-fecha {
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .35rem;
}

.fotos-badge {
  display: flex;
  align-items: center;
  gap: .3rem;
  background: var(--border);
  padding: .25rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: all var(--transition);
}
.fotos-badge.has-fotos {
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 600;
}

/* ── Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .01em;
}
.badge-primary { background: var(--primary-50); color: var(--primary); }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger  { background: var(--danger-light); color: #991b1b; }
.badge-secondary { background: var(--border); color: var(--text-muted); }
.badge-purple { background: var(--purple-light); color: var(--purple); }

/* ── Tab bar ──────────────────────────────────────── */
.tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--tab-height);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  color: var(--text-light);
  text-decoration: none;
  font-size: .65rem;
  font-weight: 600;
  transition: color var(--transition);
  position: relative;
  letter-spacing: .02em;
}
.tab-item i { font-size: 1.25rem; transition: transform var(--transition); }
.tab-item.active {
  color: var(--primary);
}
.tab-item.active i {
  transform: translateY(-1px);
}
.tab-item.active::after {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2.5px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}

.badge-tab {
  position: absolute;
  top: 6px; right: calc(50% - 20px);
  background: var(--danger);
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--card);
  animation: badgePop .3s ease;
}
@keyframes badgePop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-family: inherit;
  letter-spacing: .01em;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(30,64,175,.3);
}
.btn-primary:active { box-shadow: 0 2px 6px rgba(30,64,175,.2); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 12px rgba(239,68,68,.25); }
.btn-success { background: var(--success); color: #fff; box-shadow: 0 4px 12px rgba(16,185,129,.25); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-block { width: 100%; }
.btn-lg { padding: 1rem 1.5rem; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: .375rem .875rem; font-size: .78rem; }
.btn-icon {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background var(--transition);
  backdrop-filter: blur(4px);
}
.btn-icon:active { background: rgba(255,255,255,.35); }

/* ── Forms ────────────────────────────────────────── */
.form-group { margin-bottom: .875rem; }
.form-group label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.form-group textarea { resize: vertical; min-height: 72px; }

.form-section { padding: .75rem 1rem 0; }

.input-password { position: relative; }
.input-password input { padding-right: 3rem; }
.input-password button {
  position: absolute;
  right: .75rem; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: .25rem;
  transition: color var(--transition);
}
.input-password button:hover { color: var(--primary); }

/* ── Capture area ─────────────────────────────────── */
.capture-area {
  padding: 1rem;
  display: flex;
  gap: .75rem;
  justify-content: center;
}

.capture-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  flex: 1;
  height: 90px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .05em;
  box-shadow: 0 6px 20px rgba(30,64,175,.4);
  transition: all var(--transition);
  user-select: none;
  border: none;
}
.capture-btn-video {
  background: linear-gradient(135deg, var(--purple) 0%, #9333EA 100%);
  box-shadow: 0 6px 20px rgba(124,58,237,.4);
}
.capture-btn:active {
  transform: scale(.96);
  box-shadow: 0 2px 8px rgba(30,64,175,.3);
}
.capture-btn-video:active {
  transform: scale(.96);
  box-shadow: 0 2px 8px rgba(124,58,237,.3);
}
.capture-btn i { font-size: 2rem; }

/* ── Mini video thumb ─────────────────────────────── */
.mini-video-thumb {
  width: 100%; height: 100%;
  position: relative;
  background: #000;
  overflow: hidden;
}
.mini-video-thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
  display: block;
}
.mini-video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 1.8rem;
  pointer-events: none;
}

/* ── Foto preview ─────────────────────────────────── */
.foto-preview-area { padding: 0 1rem 1rem; }

.preview-container { position: relative; margin-bottom: .875rem; }
.preview-container img {
  width: 100%;
  border-radius: var(--radius);
  max-height: 320px;
  object-fit: cover;
  display: block;
  box-shadow: var(--shadow-md);
}
.btn-retake {
  position: absolute;
  top: .625rem; left: .625rem;
  background: rgba(0,0,0,.65);
  color: #fff;
  border: none;
  padding: .4rem .875rem;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  cursor: pointer;
  display: flex; align-items: center; gap: .3rem;
  font-family: inherit;
  font-weight: 500;
  backdrop-filter: blur(4px);
  transition: background var(--transition);
}
.btn-retake:active { background: rgba(0,0,0,.8); }

.geo-info {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .75rem;
  color: var(--text-muted);
  padding: .375rem 0;
}

/* ── Mini galería ─────────────────────────────────── */
.mini-galeria-section {
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: var(--card);
  margin-top: .75rem;
  border-radius: var(--radius) var(--radius) 0 0;
}
.mini-galeria-section h3 {
  font-size: .875rem;
  font-weight: 700;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
}

.mini-galeria {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}

.mini-foto {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--border);
  transition: transform var(--transition);
}
.mini-foto:active { transform: scale(.94); }
.mini-foto img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.empty-galeria {
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem 0;
  grid-column: 1/-1;
}

/* ── Galería full ─────────────────────────────────── */
.galeria-filters {
  padding: .75rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.galeria-filters input {
  width: 100%;
  padding: .625rem .875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  outline: none;
  font-family: inherit;
}
.galeria-filters input:focus { border-color: var(--primary-light); }

.galeria-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
  padding: .75rem;
}

.galeria-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--border);
}
.galeria-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition);
}
.galeria-item:active img { transform: scale(.97); }

.galeria-video-thumb {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1e1b4b 0%, var(--purple) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2.5rem;
}

.galeria-item-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  padding: .75rem .5rem .5rem;
}
.galeria-item-overlay p {
  color: #fff;
  font-size: .72rem;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sync-badge, .synced-badge {
  position: absolute;
  top: .35rem; right: .35rem;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem;
  box-shadow: var(--shadow-sm);
}
.sync-badge { background: var(--warning); color: #fff; }
.synced-badge { background: var(--success); color: #fff; }

/* ── Pendientes ───────────────────────────────────── */
.pendientes-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  padding: .75rem;
}

.summary-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-top: 4px solid var(--warning);
}
.summary-card-success { border-top-color: var(--success); }

.summary-number {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -.03em;
}
.summary-label {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .3rem;
  font-weight: 500;
}

.sync-action { padding: 0 .75rem .75rem; }

.sync-progress { margin-top: .75rem; }
.progress-bar {
  background: var(--border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-bottom: .35rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 999px;
  transition: width .4s ease;
}
.progress-text { font-size: .78rem; color: var(--text-muted); text-align: center; }

.pendientes-list {
  padding: 0 .75rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.pendiente-item {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: .875rem;
  display: flex;
  align-items: center;
  gap: .875rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.offline-item { border-left: 3px solid var(--warning); }

.pendiente-thumb {
  width: 52px; height: 52px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--border);
}
.pendiente-thumb img { width: 100%; height: 100%; object-fit: cover; }

.pendiente-info { flex: 1; min-width: 0; }
.pendiente-desc { font-size: .85rem; font-weight: 600; margin-bottom: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pendiente-meta { font-size: .73rem; }
.pendiente-status { flex-shrink: 0; color: var(--text-light); }

/* ── Checklist ────────────────────────────────────── */
.checklist-section {
  margin: .75rem 1rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1rem;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border-bottom: 1px solid var(--border);
}
.checklist-header:active { background: var(--border-light); }
.checklist-header h3 {
  font-size: .875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
}
.checklist-header .checklist-progress-text {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 500;
}
.checklist-toggle-icon {
  color: var(--text-muted);
  transition: transform var(--transition);
  font-size: .85rem;
}
.checklist-toggle-icon.open { transform: rotate(180deg); }

.checklist-body {
  display: none;
  padding: .5rem 0;
}
.checklist-body.open { display: block; }

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item:active { background: var(--bg); }

.checklist-item input[type="checkbox"] {
  width: 20px; height: 20px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: .1rem;
  accent-color: var(--primary);
}

.checklist-item-content { flex: 1; min-width: 0; }
.checklist-item-nombre {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: .35rem;
}
.checklist-item.checked .checklist-item-nombre {
  text-decoration: line-through;
  color: var(--text-muted);
}
.checklist-item-nota {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: .35rem .625rem;
  font-size: .78rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
  resize: none;
  min-height: 36px;
  transition: border-color var(--transition);
  display: none;
}
.checklist-item.checked .checklist-item-nota { display: block; }
.checklist-item-nota:focus { border-color: var(--primary-light); }

.checklist-categoria-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: .5rem 1rem .25rem;
  background: var(--bg);
}

.checklist-save-btn {
  margin: .75rem 1rem;
}

/* ── Modal ────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal.hidden { display: none; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  z-index: 1;
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.25rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .875rem;
  animation: slideUp .3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: .875rem; right: .875rem;
  background: var(--border);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .875rem;
  color: var(--text);
  transition: background var(--transition);
}
.modal-close:active { background: var(--border); }

.modal-content img {
  width: 100%;
  border-radius: var(--radius-sm);
  object-fit: contain;
  max-height: 55vh;
}

.modal-info { display: flex; flex-direction: column; gap: .25rem; }
.modal-desc { font-size: .9rem; font-weight: 600; }
.modal-meta { font-size: .78rem; color: var(--text-muted); }

/* ── Login ────────────────────────────────────────── */
body.login-page {
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 55%, #1d4ed8 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  padding-bottom: 1.25rem;
}

.login-bg {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2.25rem 1.75rem;
  box-shadow: 0 25px 60px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.05);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.logo-circle {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 12px 30px rgba(30,64,175,.35);
}
.logo-circle i { font-size: 2rem; color: #fff; }
.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: .3rem;
  letter-spacing: -.03em;
}
.login-logo p { font-size: .82rem; color: var(--text-muted); }

.login-footer {
  text-align: center;
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}

/* ── Orden selector ───────────────────────────────── */
.orden-selector {
  padding: .75rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.orden-selector label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── States ───────────────────────────────────────── */
.loading-state, .empty-state, .offline-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1.5rem;
  gap: .875rem;
  color: var(--text-muted);
  text-align: center;
}
.loading-state i, .empty-state i { font-size: 3rem; opacity: .4; }
.offline-page i { opacity: 1; font-size: 3rem; color: var(--warning); }

.ptr-indicator {
  background: var(--primary-light);
  color: #fff;
  text-align: center;
  padding: .5rem;
  font-size: .82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

/* ── Alerts ───────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
}
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }

/* ── Toast ────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--tab-height) + 1rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: .5rem;
  pointer-events: none;
  width: calc(100vw - 2rem);
  max-width: 360px;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: .875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s cubic-bezier(.175,.885,.32,1.275);
  display: flex;
  align-items: center;
  gap: .5rem;
  line-height: 1.35;
}
.toast-warning { background: var(--warning); }
.toast-danger  { background: var(--danger); }
.toast-success { background: var(--success); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Utilities ────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: .82rem; }

/* ── PTR / Scroll ─────────────────────────────────── */
.ordenes-list { overflow-y: auto; }

/* ── Divider label ────────────────────────────────── */
.section-divider {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: .625rem 1rem .25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Offline pending banner ───────────────────────── */
.offline-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: #fff8e1;
  border: 1px solid #f9a825;
  border-radius: var(--radius);
  padding: .625rem 1rem;
  margin: .75rem 1rem 0;
  font-size: .875rem;
  color: #5d4037;
}
.offline-banner.hidden { display: none; }

/* ── Logout tab button ────────────────────────────── */
.tab-item-logout {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--danger);
  opacity: 0.8;
}
.tab-item-logout:hover { opacity: 1; }

/* ── Logo en login ────────────────────────────────── */
.login-logo-img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  margin-bottom: .5rem;
  filter: drop-shadow(0 2px 8px rgba(30,64,175,.15));
}

/* ── Galería agrupada por orden ───────────────────── */
.galeria-orden-section { margin-bottom: 1.5rem; }

.galeria-orden-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  background: var(--surface);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  margin-bottom: .75rem;
  gap: .5rem;
}
.galeria-orden-ref {
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--text);
}
.btn-outline-primary {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: var(--radius);
  padding: .3rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-outline-primary:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
}
.btn-outline-primary:disabled { opacity: .6; cursor: default; }

/* ── Badge success ────────────────────────────────── */
.badge-success {
  background: var(--success-light, #d1fae5);
  color: #065f46;
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}

/* ── Etiqueta de sección en pendientes ────────────── */
.section-label-pendientes {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: .5rem 1rem .25rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

/* ── Acordeón de galería ─────────────────────────── */
.accordion-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: .5rem .75rem;
  overflow: hidden;
}
.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem .875rem;
  cursor: pointer;
  user-select: none;
  gap: .5rem;
  -webkit-tap-highlight-color: transparent;
}
.accordion-header:active { background: var(--surface); }
.accordion-header-left {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
}
.accordion-folder-icon {
  color: var(--primary);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.accordion-header-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.accordion-ref {
  font-weight: 700;
  font-size: .875rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.accordion-cliente {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.accordion-header-right {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}
.accordion-zip-btn {
  padding: .2rem .5rem !important;
  font-size: .75rem !important;
}
.accordion-chevron {
  color: var(--text-muted);
  font-size: .85rem;
  transition: transform var(--transition);
  flex-shrink: 0;
}
.accordion-chevron.open { transform: rotate(180deg); }
.accordion-body { border-top: 1px solid var(--border); }
.accordion-body.hidden { display: none; }

/* ── Grid 3 columnas con descripción ─────────────── */
.galeria-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: .5rem;
}
/* Cada celda es un cuadrado perfecto con la descripción como overlay */
.galeria-item-3 {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.galeria-item-3 img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s ease;
}
.galeria-item-3:active img { transform: scale(.96); }
/* Video thumb ocupa toda la celda */
.galeria-item-3 .galeria-video-thumb {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1e1b4b 0%, var(--purple) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2rem;
}
/* Descripción: gradient overlay en la parte inferior */
.galeria-item-3-desc {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent 0%, rgba(0,0,0,.72) 100%);
  padding: 1.2rem .35rem .3rem;
  color: #fff;
  font-size: .62rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Badge cloud-check: posición absoluta sobre la foto */
.galeria-item-3 .synced-badge {
  position: absolute;
  top: .25rem; right: .25rem;
  width: 18px; height: 18px;
  font-size: .55rem;
}

/* ── Modal actions row ───────────────────────────── */
.modal-actions {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
}

/* ═══════════════════════════════════════════════════
   APP HEADER FIJO
   ═══════════════════════════════════════════════════ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: calc(var(--header-height) + env(safe-area-inset-top));
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  display: flex;
  align-items: center;
  padding: env(safe-area-inset-top, 0px) .75rem .35rem;
  gap: .625rem;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.hamburger-btn {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 38px; height: 38px;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}
.hamburger-btn:active { background: rgba(255,255,255,.3); }
.header-logo {
  display: flex; align-items: center;
  text-decoration: none;
}
.header-logo img {
  height: 30px;
  border-radius: 6px;
  display: block;
}
.header-title {
  flex: 1;
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-user {
  color: rgba(255,255,255,.9);
  font-size: .78rem;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  flex-shrink: 1;
}
.header-logout-btn {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}
.header-logout-btn:active { background: rgba(255,255,255,.35); }

/* ═══════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════ */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 290;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  background: var(--card);
  z-index: 300;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  padding: 1.25rem 1rem 1rem;
  padding-top: calc(1.25rem + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-logo {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.3);
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-username {
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-role {
  color: rgba(255,255,255,.65);
  font-size: .72rem;
  margin-top: .1rem;
  display: block;
}
.sidebar-close-btn {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .85rem;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-close-btn:active { background: rgba(255,255,255,.35); }

.sidebar-modules {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 0;
  -webkit-overflow-scrolling: touch;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .875rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background var(--transition);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-item:active { background: var(--border-light); }
.sidebar-item.active {
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 700;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.sidebar-item i {
  width: 20px;
  text-align: center;
  font-size: .95rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.sidebar-item.active i { color: var(--primary); }
.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 .3rem;
}
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: .375rem 1.25rem;
}
.sidebar-section-title {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  padding: .75rem 1.25rem .25rem;
}
.sidebar-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
}
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  background: none;
  border: 1.5px solid var(--danger);
  color: var(--danger);
  font-size: .875rem;
  font-weight: 600;
  padding: .625rem 1rem;
  cursor: pointer;
  font-family: inherit;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.sidebar-logout-btn:active { background: var(--danger-light); }

.sidebar-app-title {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-light);
  text-align: center;
  margin-bottom: .5rem;
}

/* ═══════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════ */
.dashboard-container {
  padding: 1rem;
  max-width: 500px;
  margin: 0 auto;
}
.dashboard-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.dashboard-greeting h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.dash-fecha {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: .1rem;
}
.btn-sync-dash {
  background: var(--primary-50);
  border: none;
  color: var(--primary);
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-sync-dash:active { background: #dbeafe; }

.dash-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .625rem;
  margin-bottom: 1.5rem;
}
.dash-stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: .875rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow var(--transition);
  border: 1px solid var(--border);
}
.dash-stat-card:active { box-shadow: var(--shadow-md); }
.dash-stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.dash-stat-info { min-width: 0; }
.dash-stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  display: block;
  line-height: 1;
}
.dash-stat-label {
  font-size: .7rem;
  color: var(--text-muted);
  display: block;
  margin-top: .2rem;
  line-height: 1.2;
}

.dash-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .625rem;
}
.dash-quick-access {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .625rem;
  margin-bottom: 1.5rem;
}
.dash-quick-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem .875rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.dash-quick-card:active { box-shadow: var(--shadow-md); }
.dash-quick-card i {
  font-size: 1.5rem;
  color: var(--primary);
}
.dash-quick-card span {
  font-size: .78rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

/* skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  color: transparent !important;
  min-width: 2rem;
  user-select: none;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* dash ordenes recientes */
.dash-orden-mini {
  background: var(--card);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
.dash-orden-mini:active { background: var(--border-light); }
.dash-orden-mini-info { flex: 1; min-width: 0; }
.dash-orden-mini-ref {
  font-weight: 700;
  font-size: .875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-orden-mini-cliente {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════
   ORDEN DETALLE — TABS
   ═══════════════════════════════════════════════════ */
.detail-tabs {
  display: flex;
  background: var(--card);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: calc(var(--header-height) + env(safe-area-inset-top) + 60px);
  z-index: 90;
}
.detail-tab {
  flex: 1;
  background: none;
  border: none;
  padding: .75rem .5rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.detail-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content { padding: .875rem; }
.tab-content.hidden { display: none; }

.detail-info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .5rem;
  margin-bottom: 1rem;
}
.detail-info-row {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border-light);
}
.detail-info-row:last-child { border-bottom: none; }
.detail-info-row i {
  color: var(--primary);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  margin-top: .15rem;
  font-size: .875rem;
}
.detail-info-label {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  display: block;
  margin-bottom: .1rem;
}
.detail-info-value {
  font-size: .875rem;
  color: var(--text);
  font-weight: 500;
}

.servicios-list { list-style: none; margin-top: .5rem; }
.servicio-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: .875rem;
}
.servicio-item:last-child { border-bottom: none; }
.servicio-item i {
  color: var(--success);
  font-size: .8rem;
  flex-shrink: 0;
}

.detail-actions-bar {
  position: sticky;
  bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: .75rem;
  display: flex;
  gap: .5rem;
  z-index: 90;
}
.detail-actions-bar .btn { flex: 1; justify-content: center; }

/* Estado change select */
.estado-select-wrapper {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .75rem;
}
.estado-select-wrapper select {
  flex: 1;
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
}

/* ═══════════════════════════════════════════════════
   ORDEN CARDS MEJORADAS
   ═══════════════════════════════════════════════════ */
.orden-card {
  background: var(--card);
  border-radius: var(--radius);
  margin: .5rem .75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow var(--transition);
}
.orden-card:active { box-shadow: var(--shadow-md); }
.orden-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem .5rem;
  gap: .5rem;
}
.orden-ref {
  font-weight: 800;
  font-size: .95rem;
  color: var(--text);
  letter-spacing: -.01em;
}
.orden-card-body {
  padding: 0 1rem .5rem;
}
.orden-cliente {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .2rem;
}
.orden-cliente i { color: var(--primary-light); font-size: .75rem; }
.orden-empresa, .orden-direccion {
  font-size: .78rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  margin-bottom: .15rem;
}
.orden-empresa i, .orden-direccion i {
  color: var(--text-light);
  font-size: .72rem;
  margin-top: .1rem;
  flex-shrink: 0;
}
.orden-servicios-preview {
  margin: .375rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
}
.servicio-tag {
  font-size: .67rem;
  background: var(--primary-50);
  color: var(--primary);
  padding: .15rem .5rem;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.orden-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 1rem .75rem;
  border-top: 1px solid var(--border-light);
}
.orden-fecha {
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.fotos-badge {
  font-size: .75rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: .3rem;
  font-weight: 600;
}
.fotos-badge.has-fotos { color: var(--primary); }

/* badge de estado con colores */
.badge-pendiente   { background: #fee2e2; color: #dc2626; }
.badge-iniciado    { background: #fef3c7; color: #d97706; }
.badge-proceso     { background: #dbeafe; color: #1d4ed8; }
.badge-finalizado  { background: #d1fae5; color: #059669; }
.badge-cancelado   { background: #f1f5f9; color: #64748b; }

/* badge genérico (fallback) */
.badge-secondary { background: var(--border); color: var(--text-muted); }

/* ══════════════════════════════════════════════════
   MOBILE POLISH v3 — mejoras responsive celular
   ══════════════════════════════════════════════════ */

/* ── Botones captura: más compactos ─────────────── */
.capture-area-3 .capture-btn {
  height: 62px;
  gap: .2rem;
}
.capture-area-3 .capture-btn i { font-size: 1.375rem; }
.capture-area-3 { gap: .375rem; padding: .75rem .75rem .5rem; }

/* ── Detail tabs: scroll horizontal + 13px ──────── */
.detail-tabs {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.detail-tabs::-webkit-scrollbar { display: none; }
.detail-tab {
  flex-shrink: 0;
  font-size: .8125rem;        /* 13px */
  padding: .625rem .625rem;
  white-space: nowrap;
  border-bottom-width: 3px;
  margin-bottom: -2px;
}
.detail-tab.active { border-bottom-width: 3px; }

/* ── Orden cards: padding 12px ──────────────────── */
.orden-card-header { padding: .625rem .75rem .375rem; }
.orden-card-body   { padding: 0 .75rem .375rem; }
.orden-card-footer { padding: .375rem .75rem .625rem; }
.orden-ref         { font-size: .9375rem; }    /* 15px */
.orden-cliente     { font-size: .8125rem; }    /* 13px */
.orden-empresa, .orden-direccion { font-size: .75rem; }
.servicio-tag { font-size: .65rem; }

/* ── Botones generales: touch target 44px ────────── */
.btn {
  min-height: 44px;
  border-radius: 10px;
  font-size: .875rem;          /* 14px */
}
.btn-sm {
  min-height: 36px;
  border-radius: 8px;
  font-size: .8rem;
}
.btn-lg { min-height: 52px; border-radius: 12px; }

/* ── Sidebar: font 14px, ícono 18px ─────────────── */
.sidebar-item {
  font-size: .875rem;
  padding: .8125rem 1.25rem;
}
.sidebar-item i { font-size: 1.125rem; }

/* ── Badges: más compactos ──────────────────────── */
.badge { padding: .175rem .55rem; font-size: .675rem; }

/* ── Galería: gap y radius ──────────────────────── */
.galeria-grid-3 { gap: 4px; }
.galeria-item-3 { border-radius: 8px; }
.galeria-item-3-desc { font-size: .65rem; }

/* ── Video play overlay: más visible ─────────────── */
.mini-video-play-overlay { font-size: 2.2rem; }

/* ── Header orden: no truncar en 320px ──────────── */
.page-header-captura h2 {
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-subtitle {
  max-width: calc(100vw - 110px);
  display: block;
}

/* ── Detail info: layout más compacto ────────────── */
.tab-content { padding: .75rem; }
.detail-info-row { padding: .4rem 0; }
.detail-info-value { font-size: .84rem; }
