/* ==========================================
   APP V2 - ESTILOS ADICIONALES
   ========================================== */

/* Layout v2 */
.app-container { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px; background: #1a1a2e; color: #fff;
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0;
  z-index: 200; transform: translateX(-100%); transition: transform .3s;
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  padding: 16px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo { max-width: 40px; border-radius: 8px; }
.sidebar-title { font-weight: 700; font-size: 1rem; flex: 1; }
.sidebar-close { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav .nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; color: rgba(255,255,255,0.85);
  text-decoration: none; font-size: 0.95rem; cursor: pointer; transition: background .2s;
}
.sidebar-nav .nav-item:hover, .sidebar-nav .nav-item.active { background: #005b9f; color: #fff; }
.nav-icon { font-size: 1.2rem; }
.nav-divider {
  padding: 8px 20px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px;
  color: rgba(255,255,255,0.4); margin-top: 8px;
}

.sidebar-footer {
  padding: 16px; border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem; display: flex; align-items: center; justify-content: space-between;
}

.main-content { flex: 1; margin-left: 0; width: 100%; }
@media (min-width: 1024px) {
  .sidebar { transform: translateX(0); position: sticky; }
  .main-content { margin-left: 260px; width: calc(100% - 260px); }
}

/* Top bar */
.top-bar {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(90deg, #005b9f, #004070);
  color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.top-bar h2 { font-size: 1rem; font-weight: 600; flex: 1; }
.menu-btn {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 1.2rem; cursor: pointer;
}

/* Vistas */
.vista { padding: 16px; max-width: 1400px; margin: 0 auto; }

/* Semana nav */
.week-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 16px; }
.semana-label { font-weight: 700; font-size: 1.05rem; min-width: 200px; text-align: center; }

/* Week grid */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.dia-col {
  background: #fff; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  min-height: 180px; display: flex; flex-direction: column;
  scroll-margin-top: 70px; /* que HOY no quede oculto bajo la top-bar en el auto-scroll */
}
.dia-hoy { border: 2px solid #005b9f; }
.dia-header {
  padding: 10px; text-align: center; font-weight: 700; font-size: 0.85rem;
  border-bottom: 2px solid #f4f6f9; background: #fafafa; border-radius: 8px 8px 0 0;
}
.dia-hoy .dia-header { background: #005b9f; color: #fff; }
.dia-tiendas { flex: 1; padding: 8px; }
.dia-vacio { text-align: center; color: #6c757d; font-size: 0.8rem; padding: 20px 8px; }

@media (max-width: 900px) { .week-grid { grid-template-columns: 1fr; } }

/* Tienda card en semana */
.tienda-card {
  background: #fff; border-radius: 8px; padding: 12px; margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); cursor: pointer;
  border-left: 4px solid #6c757d; transition: transform .1s;
  display: flex; flex-direction: column; min-height: 120px;
}
.tienda-card .tienda-cliente { font-size: 0.7rem; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.tienda-card .tienda-nombre { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; line-height: 1.2; }
.tienda-card .tienda-info { font-size: 0.75rem; color: #6c757d; min-height: 1.2em; margin-bottom: 6px; }
.tienda-card .tienda-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.tienda-card .estado-tag { font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; }
.tienda-card .estado-tag.pendiente { background: #fff3cd; color: #856404; }
.tienda-card .estado-tag.en_curso { background: #ffe5cc; color: #d35400; }
.tienda-card .estado-tag.finalizado { background: #d4edda; color: #155724; }
.tienda-card .hora-tag { font-size: 0.75rem; color: #555; }
.tienda-card .equipo-tag { font-size: 0.7rem; color: #005b9f; background: #e3f2fd; padding: 2px 6px; border-radius: 4px; }
.tienda-card .btn-sm { padding: 4px 12px; font-size: 0.75rem; min-width: 50px; }
.tienda-card:active { transform: scale(0.98); }
.tienda-card.estado-planificado { border-left-color: #005b9f; }
.tienda-card.estado-pendiente { border-left-color: #ffc107; }
.tienda-card.estado-en_curso { border-left-color: #e67e22; background: #fff8f0; }
.tienda-card.estado-finalizado { border-left-color: #28a745; background: #f6fff8; }
.tienda-card.estado-sin_planificar { border-left-color: #6c757d; opacity: 0.7; }
.tc-nombre { font-weight: 700; font-size: 0.9rem; margin-bottom: 2px; }
.tc-meta { font-size: 0.75rem; color: #6c757d; }
.badge-realizado {
  display: inline-block; font-size: 0.65rem; background: #28a745; color: #fff;
  padding: 2px 8px; border-radius: 10px; margin-top: 4px;
}

/* Tienda header */
.tienda-header {
  background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.tienda-header h2 { font-size: 1.3rem; margin-bottom: 4px; }
.tienda-header p { color: #6c757d; font-size: 0.9rem; }

/* Admin calendario */
.admin-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  margin-bottom: 16px; background: #fff; padding: 16px; border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.admin-bar select, .admin-bar input {
  padding: 8px 12px; border-radius: 6px; border: 1px solid #ddd;
  font-size: 0.9rem; min-width: 160px;
}

.calendario-leyenda {
  display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap;
}
.leyenda-item { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.leyenda-item .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.leyenda-item .dot.planificado { background: #005b9f; }
.leyenda-item .dot.realizado { background: #28a745; }
.leyenda-item .dot.pendiente { background: #ffc107; }
.leyenda-item .dot.sin-planificar { background: #6c757d; }

.calendario-dias { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-bottom: 20px; }
@media (max-width: 900px) { .calendario-dias { grid-template-columns: 1fr; } }

.cal-dia {
  background: #fff; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  min-height: 200px; display: flex; flex-direction: column;
}
.cal-dia-header {
  padding: 10px; font-weight: 700; font-size: 0.85rem;
  border-bottom: 2px solid #f4f6f9; background: #fafafa;
  border-radius: 8px 8px 0 0; display: flex; justify-content: space-between;
}
.cal-dia-header span { font-weight: 400; color: #6c757d; }
.cal-dia-tiendas { flex: 1; padding: 8px; }
.cal-dia.drag-over { background: #e8f1fa; border: 2px dashed #005b9f; }

.tienda-drag {
  background: #fff; border: 1px solid #e1e5eb; border-radius: 8px;
  padding: 10px; margin-bottom: 6px; cursor: grab; font-size: 0.8rem;
  border-left: 4px solid #6c757d; transition: transform .1s;
}
.tienda-drag.dragging { opacity: 0.5; transform: scale(0.98); }
.tienda-drag.inamovible { cursor: not-allowed; opacity: 0.7; }
.tienda-drag.estado-planificado { border-left-color: #005b9f; }
.tienda-drag.estado-pendiente { border-left-color: #ffc107; }
.tienda-drag.estado-realizado { border-left-color: #28a745; background: #f6fff8; }
.tienda-drag.sin-planificar { border-left-color: #6c757d; background: #f8f9fa; }
.td-nombre { font-weight: 700; }
.td-meta { font-size: 0.75rem; color: #6c757d; }
.td-estado select { margin-top: 6px; padding: 4px 8px; border-radius: 4px; border: 1px solid #ddd; font-size: 0.75rem; width: 100%; }

.sin-planificar-pool {
  background: #fff; border-radius: 8px; padding: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06); border: 2px dashed #ddd;
}
.sin-planificar-pool h3 { margin-bottom: 12px; font-size: 1rem; }
.tienda-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.tienda-pool .tienda-drag { flex: 1; min-width: 180px; margin-bottom: 0; }

/* Planificador */
.planificador-panel {
  background: #fff; border-radius: 8px; padding: 24px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.form-row .form-group { flex: 1; min-width: 200px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group select {
  width: 100%; padding: 10px 12px; border-radius: 6px; border: 1px solid #ddd; font-size: 0.95rem;
}
.plan-preview { margin-top: 24px; }
.plan-dia { background: #f8f9fa; border-radius: 8px; padding: 16px; margin-bottom: 12px; }
.plan-dia ul { margin: 8px 0 0 20px; }
.plan-dia li { margin-bottom: 4px; }

/* Dashboard informes */
.informes-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.informes-bar select { padding: 8px 12px; border-radius: 6px; border: 1px solid #ddd; font-size: 0.9rem; min-width: 200px; }

.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.dash-card {
  background: #fff; border-radius: 8px; padding: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06); text-align: center;
  border-top: 4px solid #005b9f;
}
.dash-card.ok { border-top-color: #28a745; }
.dash-card.warn { border-top-color: #ffc107; }
.dash-card.info { border-top-color: #17a2b8; }
.dash-card.gray { border-top-color: #6c757d; }
.dash-num { font-size: 2rem; font-weight: 700; color: #1a1a2e; }
.dash-label { font-size: 0.8rem; color: #6c757d; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

.dashboard-chart-wrap { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 24px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.dashboard-chart-wrap canvas { width: 100%; height: 300px; }

.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,0.06); font-size: 0.85rem; }
.data-table th { background: #1a1a2e; color: #fff; padding: 10px; text-align: left; font-weight: 600; }
.data-table td { padding: 10px; border-bottom: 1px solid #ecf0f1; }
.data-table tr:hover { background: #f8f9fa; }

.progress-bar { background: #e9ecef; border-radius: 10px; height: 8px; overflow: hidden; width: 100px; }
.progress-bar div { background: #28a745; height: 100%; border-radius: 10px; transition: width .3s; }

/* Equipos */
.equipos-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid #e1e5eb; }
.tab-btn {
  padding: 10px 20px; background: none; border: none; font-size: 0.95rem;
  font-weight: 600; cursor: pointer; color: #6c757d;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab-btn.active { color: #005b9f; border-bottom-color: #005b9f; }

.equipos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.equipo-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
.equipo-card h4 { margin-bottom: 8px; }
.operarios-list { display: flex; flex-direction: column; gap: 8px; }
.operario-item {
  background: #fff; border-radius: 8px; padding: 12px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06); display: flex;
  align-items: center; justify-content: space-between;
}

/* Tickets admin */
.tickets-filtros {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  margin-bottom: 16px; background: #fff; padding: 16px;
  border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.tickets-filtros select, .tickets-filtros input { padding: 8px 12px; border-radius: 6px; border: 1px solid #ddd; font-size: 0.9rem; }

.ticket-admin-item {
  display: flex; gap: 12px; background: #fff; border-radius: 8px;
  padding: 12px; margin-bottom: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); align-items: center;
}
.ticket-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; cursor: pointer; }
.ticket-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ticket-info strong { font-size: 0.9rem; }
.ticket-info span { font-size: 0.8rem; color: #6c757d; }

/* Tickets modal */
.modal-tickets {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-tickets-content {
  background: #fff; border-radius: 16px; width: 100%; max-width: 460px;
  padding: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); max-height: 90vh; overflow-y: auto;
}
.modal-tickets-content h3 { margin-bottom: 12px; }
.modal-tickets-content h4 { margin: 16px 0 8px; font-size: 0.95rem; }
.modal-tickets-content select,
.modal-tickets-content input[type="text"],
.modal-tickets-content input[type="number"],
.modal-tickets-content input[type="file"] {
  width: 100%; padding: 10px 12px; border-radius: 6px; border: 1px solid #ddd;
  font-size: 0.9rem; margin-bottom: 10px;
}
.ticket-list { margin-bottom: 12px; }
.ticket-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: #f8f9fa; border-radius: 8px;
  margin-bottom: 6px; cursor: pointer; font-size: 0.85rem;
}
.ticket-item:hover { background: #e8f1fa; }
.ticket-cat { font-size: 0.7rem; color: #6c757d; background: #eee; padding: 2px 8px; border-radius: 10px; }

/* Campañas */
.campanyas-bar { margin-bottom: 16px; }
.campanyas-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.campanya-card {
  background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.campanya-card h4 { margin-bottom: 8px; }

/* Modal genérico */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 300;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-content {
  background: #fff; border-radius: 16px; width: 100%; max-width: 500px;
  padding: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); max-height: 90vh; overflow-y: auto;
}

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1a1a2e; color: #fff; padding: 12px 24px;
  border-radius: 24px; font-size: 0.9rem; z-index: 500;
  opacity: 0; transition: all .3s; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Login */
.login-error { color: #dc3545; font-size: 0.85rem; margin-top: 12px; }

/* Responsive admin */
@media (max-width: 768px) {
  .admin-bar { flex-direction: column; align-items: stretch; }
  .admin-bar select, .admin-bar input { width: 100%; }
  .form-row { flex-direction: column; }
  .tickets-filtros { flex-direction: column; align-items: stretch; }
}

/* ==========================================
   TICKETS DASHBOARD V2
   ========================================== */
.tickets-dashboard { max-width: 1200px; margin: 0 auto; }

/* Summary cards */
.tickets-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.tkt-card {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); text-align: center;
  border-top: 4px solid #005b9f;
}
.tkt-card.total { border-top-color: #005b9f; }
.tkt-card.euros { border-top-color: #27ae60; }
.tkt-card.media { border-top-color: #f39c12; }
.tkt-num { font-size: 1.8rem; font-weight: 700; color: #1a1a2e; }
.tkt-label { font-size: 0.75rem; color: #6c757d; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* Section headers */
.tickets-section { margin-bottom: 24px; }
.tickets-section h4 { font-size: 1rem; color: #34495e; margin-bottom: 12px; }

/* Bar charts */
.tkt-bars { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.tkt-bar-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 0.85rem;
}
.tkt-bar-label { min-width: 100px; font-weight: 600; color: #2c3e50; text-transform: capitalize; }
.tkt-bar-wrap { flex: 1; background: #ecf0f1; border-radius: 8px; height: 20px; overflow: hidden; }
.tkt-bar-fill { height: 100%; border-radius: 8px; transition: width 0.4s ease; }
.tkt-bar-val { min-width: 120px; text-align: right; color: #6c757d; font-size: 0.8rem; }

/* Timeline */
.tkt-timeline {
  display: flex; align-items: flex-end; gap: 4px;
  background: #fff; border-radius: 12px; padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); height: 160px;
}
.tkt-timeline-col {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
}
.tkt-timeline-bar {
  width: 100%; background: linear-gradient(180deg, #005b9f, #004070); border-radius: 4px 4px 0 0;
  min-height: 4px; transition: height 0.4s ease;
}
.tkt-timeline-date { font-size: 0.65rem; color: #6c757d; }

/* Table */
.tickets-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.06); font-size: 0.85rem; }
.tickets-table th { background: #34495e; color: #fff; padding: 12px 10px; text-align: left; font-weight: 600; }
.tickets-table td { padding: 10px; border-bottom: 1px solid #ecf0f1; }
.tickets-table tr:hover { background: #f8f9fa; }
.tkt-cat-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }

.tickets-empty { text-align: center; padding: 60px 20px; color: #6c757d; font-size: 1rem; }
@media (max-width: 768px) {
  .admin-bar { flex-direction: column; align-items: stretch; }
  .admin-bar select, .admin-bar input { width: 100%; }
  .form-row { flex-direction: column; }
  .tickets-filtros { flex-direction: column; align-items: stretch; }
}

/* ==========================================
   FOTOS MINIATURA RESPONSIVAS (baleares style)
   ========================================== */
.foto-row { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.foto-box { flex: 1; position: relative; min-width: 140px; }
.foto-box.add { background: #e8f1fa; border: 2px dashed var(--primary); cursor: pointer; min-height: 140px; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--primary); transition: all .2s; }
.foto-box.add:hover { background: #d0e3f7; }
.foto-box.add .label { font-size: 0.75rem; font-weight: 600; }
.foto-box img { max-width: 100%; border-radius: var(--radius-sm); object-fit: cover; }
.foto-box .label { font-size: 0.8rem; font-weight: 700; color: var(--gray); }
.foto-box .btn-cam {
  background: var(--primary); color: var(--white); border: none; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem; cursor: pointer;
}
.foto-box .na-btn {
  background: transparent; color: var(--gray); border: 1px solid #d1d5db; padding: 6px 12px; border-radius: 14px; font-size: 0.75rem; cursor: pointer; margin-top: 6px;
}
.foto-box .na-btn.na-active { background: #e9ecef; color: #6c757d; font-weight: 700; }

/* Metadatos en foto */
.foto-thumb { position: relative; display: inline-block; width: 100%; }
.foto-thumb img { width: 100%; border-radius: var(--radius-sm); }
.foto-meta {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.7); color: #fff; font-size: 0.65rem;
  padding: 4px 8px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  display: flex; justify-content: space-between; align-items: center;
}
.foto-meta .coords { font-size: 0.6rem; opacity: 0.9; }
.foto-warning {
  position: absolute; top: 4px; left: 4px;
  background: var(--danger); color: #fff; font-size: 0.65rem; font-weight: 700;
  padding: 2px 8px; border-radius: 8px;
}

/* Botón eliminar foto */
.foto-delete {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger); color: #fff; border: none; width: 28px; height: 28px;
  border-radius: 50%; font-size: 0.9rem; cursor: pointer; display: flex;
  align-items: center; justify-content: center; z-index: 2;
}

/* Tipo card */
.tipo-card {
  background: var(--white); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.tipo-card h4 { font-size: 1rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.tipo-card h4 .cat-tag { font-size: 0.65rem; text-transform: uppercase; background: var(--light); padding: 2px 8px; border-radius: 8px; color: var(--gray); }

/* Tienda acciones fijas abajo */
.tienda-acciones {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--white); padding: 16px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1); display: flex; gap: 10px; z-index: 50;
}

/* Responsive */
@media (max-width: 400px) {
  .foto-row { flex-direction: column; }
}

/* ==========================================
   VISTA INFORME DENTRO DE APPV2
   ========================================== */
.informe-vista {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.informe-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #f4f6f9;
}
.informe-header h2 { font-size: 1.2rem; margin-bottom: 4px; }
.informe-header p { color: #6c757d; font-size: 0.9rem; }
.informe-fotos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.informe-foto-card {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}
.informe-foto-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}
.informe-foto-card .fase-label {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 6px;
  text-transform: uppercase;
}
.informe-tipo-section {
  margin-bottom: 24px;
}
.informe-tipo-section h4 {
  font-size: 1rem;
  color: #1a1a2e;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#vistaTienda { padding-bottom: 100px; }
/* ===== RESPONSIVE TOTAL (sin limites fijos) ===== */
html, body { max-width: 100%; overflow-x: hidden; }
.app-container, .main-content { width: 100%; max-width: 100%; min-width: 0; }
.vista { width: 100%; max-width: none; margin: 0; }
.tickets-dashboard, .container { max-width: none; }
#dashTabla, .tickets-section, .data-table-wrap { max-width: 100%; overflow-x: auto; }
.week-nav, .admin-bar { flex-wrap: wrap; }
.calendario-mes, .calendario-dias, .week-grid { min-width: 0; }
.form-row { flex-wrap: wrap; }
.foto-box, .tienda-drag { min-width: 0; }
@media (max-width: 600px) { .fotos-grid { grid-template-columns: 1fr; } }
/* Movil: semana nav TODO en una fila (aunque no quepa holgura) */
@media (max-width: 900px) {
  .week-nav { flex-wrap: nowrap; gap: 4px; margin-bottom: 8px; justify-content: space-between; }
  .week-nav .btn { font-size: 0.72rem; padding: 5px 7px; white-space: nowrap; flex: 0 0 auto; }
  .week-nav .semana-label { min-width: 0; flex: 1 1 auto; font-size: 0.8rem; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Calendario mensual: en pantallas estrechas NO se aplasta, se desplaza a la derecha */
@media (max-width: 1023px) {
  .calendario-mes {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    width: 100%;
    grid-template-columns: repeat(7, minmax(132px, 1fr));
  }
  .calendario-mes .cal-dia { min-width: 0; }
}


/* Desktop: barra superior a todo el ancho + sidebar fija (pese al flex inline de JS) */
@media (min-width: 1024px) {
  .sidebar { position: fixed !important; top: 60px; bottom: 0; left: 0; width: 260px; transform: none !important; z-index: 100; }
  .main-content { width: calc(100% - 260px) !important; margin: 0 0 0 260px !important; flex: none !important; min-width: 0; }
  .top-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 150; padding-left: 260px; }
  .top-bar .menu-btn { display: none; }
  .vista { width: auto !important; max-width: none; padding-top: 84px; }
  #informeWebWrap, #informeWebFrame { width: 100% !important; max-width: 100%; }
}


/* ===== Mini chips de fichas (fotos / tickets / horas) ===== */
.miniinfo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-top: 3px;
}
.mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 5px;
  align-items: center;
}
.tienda-card .miniinfo {
  margin-top: 2px;
  cursor: pointer;
}
.tienda-card .miniinfo:hover .mini-chip { border-color: #a9aeb5; }
.mini-chip {
  font-size: 0.68rem;
  line-height: 1.7;
  border-radius: 10px;
  padding: 0 6px;
  white-space: nowrap;
  background: #f1f3f5;
  border: 1px solid #e2e6ea;
  color: #495057;
}
.mini-chip.b-fotos { background: #e7f1fd; border-color: #bcd7f4; color: #0b63c0; }
.mini-chip.b-tick { background: #fff4de; border-color: #f0d9a0; color: #8a5c00; }
.mini-chip.b-ini { background: #e6f6e9; border-color: #a9dab4; color: #1e7f37; }
.mini-chip.b-fin { background: #fdeaea; border-color: #f2c1c1; color: #b02a2a; }
.mini-chip.b-dur { background: #f3edff; border-color: #d7c6f5; color: #5f3dc4; }
.mini-chip.b-range { background: #e6f6e9; border-color: #8fca9d; color: #146b2c; font-weight: 600; }
.cal-tienda-mini .miniinfo {
  align-items: center;
}
.cal-tienda-mini .miniinfo .mini-row {
  justify-content: center;
}
.cal-tienda-mini .mini-chip {
  font-size: 0.6rem;
  padding: 0 4px;
  line-height: 1.6;
}


/* ===== Fotos de informe/tienda: miniaturas NORMALIZADAS y responsive =====
   - Todas las fotos con el mismo tamaño (no ocupan todo el ancho)
   - Con muchas caben en filas (se ven todas) y con 1 sola queda pequeña
   - Se abren en grande al pulsarlas (verFoto) */
.foto-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: flex-start;
}
.foto-row .foto-box {
  flex: 0 0 auto;
  width: clamp(120px, 28vw, 190px);
  min-width: 0;
}
.foto-row .foto-box.add {
  min-height: 0;
  aspect-ratio: 1 / 1;
}
.foto-row .foto-thumb img {
  width: 100%;
  height: clamp(110px, 26vw, 170px);
  object-fit: cover;
  display: block;
  border-radius: var(--radius-sm, 6px);
}
.informe-fotos-grid {
  grid-template-columns: repeat(auto-fill, minmax(110px, 190px));
  justify-content: start;
}
.informe-foto-card {
  overflow: hidden;
}
.informe-foto-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}
@media (max-width: 520px) {
  .foto-row .foto-box { width: calc(50% - 4px); }
  .foto-row .foto-thumb img { height: 120px; }
  .informe-foto-card img { height: 130px; }
}


/* Asegura filas (miniaturas) también en móvil muy estrecho, incluso al abrir la tienda desde Vista Campo */
.foto-row { flex-direction: row; }
@media (max-width: 400px) {
  .foto-row { flex-direction: row !important; }
}

/* ===== Navegación de mes del Calendario Mensual ===== */
.cal-mes-nav { display: flex; align-items: center; gap: 6px; }
.cal-mes-nav .btn { padding: 6px 12px; line-height: 1; font-size: 1.05rem; font-weight: 700; }
.cal-mes-nav input[type="month"] {
  padding: 7px 10px; border-radius: 6px; border: 1px solid #ddd; font-size: 0.9rem;
  font-family: inherit; color: #2d3748; background: #fff; min-width: 150px; cursor: pointer;
}
.cal-mes-nav input[type="month"]:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.cal-mes-info {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: #5b6b7c;
  background: #f1f5f9; border: 1px solid #e2e8f0; padding: 6px 12px; border-radius: 20px; font-weight: 600;
}
.cal-mes-info strong { color: #2d3748; }
.cal-mes-info .n { color: var(--primary); font-weight: 700; }
@media (max-width: 600px) {
  .cal-mes-nav { width: 100%; }
  .cal-mes-nav input[type="month"] { flex: 1; min-width: 0; }
  .cal-mes-info { width: 100%; justify-content: center; }
}


/* ===== Calendario Mensual: datos de ruta del planificador (km, horas, hotel, viajes y ferrys) =====
   - Resumen del dia (km y horas) encima de las tiendas, como en el planificador de rutas
   - Chips: viaje ida/vuelta, hotel, tramo >200 km, ferrys, llegada tarde y equipo
   - Tarjeta distinta (discontinua) para los dias de SOLO viaje */
.cal-dia-plan {
  margin: 4px 8px 0; padding: 2px 6px; font-size: 0.68rem; line-height: 1.35;
  background: #f4f7fa; border-radius: 4px; color: #5b6b7c; font-weight: 600;
}
.cal-dia-plan.viaje { background: #e8f1fa; color: #1f4e79; }
.cal-dia-badges { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px 8px 0; }
.cal-badge {
  display: inline-block; font-size: 0.66rem; line-height: 1.5; padding: 0 4px;
  border-radius: 4px; background: #eef2f6; border: 1px solid #dfe6ee;
}
.cal-badge.b-hotel { background: #fff4e5; border-color: #f3d9b0; }
.cal-badge.b-viaje { background: #e8f1fa; border-color: #bcd7f4; }
.cal-badge.b-200 { background: #ffecec; border-color: #f2c1c1; }
.cal-badge.b-ferry { background: #e0f7fa; border-color: #a5e3ea; }
.cal-badge.b-noche { background: #eef0ff; border-color: #ccd3f5; }
.cal-badge.b-eq { background: #e8f5e9; border-color: #b6dfbc; }
.cal-tienda-mini.viaje-mini {
  background: #eaf2fb !important; border: 1px dashed #7aa7d1; cursor: grab;
}
.cal-dia.dia-viaje-ida, .cal-dia.dia-viaje-vuelta { background: #f7fbff; }

/* ===== Calendario Mensual: dia con DOS equipos -> un bloque por equipo =====
   Cada equipo lleva sus propios chips (viaje ida/vuelta, hotel, avisos), su resumen
   de km/horas y sus tiendas. Con un solo equipo la celda se pinta como siempre. */
.cal-equipo-grupo {
  margin: 4px 6px 0; padding-bottom: 2px; border-left: 3px solid #cbd5e0;
  border-radius: 4px; background: #fbfdff;
}
.cal-equipo-grupo[data-equipo="equipo1"] { border-left-color: #2b6cb0; }
.cal-equipo-grupo[data-equipo="equipo2"] { border-left-color: #b7791f; }
.cal-equipo-grupo[data-equipo="equipo3"] { border-left-color: #2f855a; }
.cal-equipo-grupo[data-equipo=""] { border-left-color: #a0aec0; }
.cal-equipo-cabecera { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 3px 6px 0; }
.cal-equipo-nombre { font-size: 0.62rem; font-weight: 700; color: #2b4a6f; letter-spacing: 0.02em; }
.cal-equipo-chips { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.cal-equipo-resumen { padding: 1px 6px 0; font-size: 0.62rem; font-weight: 600; color: #5b6b7c; line-height: 1.3; }
.cal-dia-tiendas.cal-tiendas-grupo { padding: 4px 6px 4px; }
@media (max-width: 600px) {
  .cal-dia-plan { font-size: 0.72rem; }
  .cal-badge { font-size: 0.7rem; }
  .cal-equipo-nombre, .cal-equipo-resumen { font-size: 0.7rem; }
}

/* Noche fuera (día en blanco con hotel, el equipo está en la zona) */
.cal-tienda-mini.noche-mini {
  background: #fff8e6 !important; border: 1px dashed #e0b95e; cursor: grab;
}

/* ===== Vista Campo: km entre tiendas y accesos directos del operario ===== */
.tienda-km { font-size: 0.68rem; color: #5b6b7c; line-height: 1.35; margin-top: 3px; word-break: break-word; }
.tienda-acciones { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.tienda-acciones .btn { padding: 4px 8px; font-size: 0.72rem; line-height: 1.2; }
.tienda-card.extra-viaje { border-left-color: #2b6cb0; background: #eaf2fb; }
.tienda-card.extra-noche { border-left-color: #b7791f; background: #fff8e6; }
@media (max-width: 600px) { .tienda-km { font-size: 0.74rem; } .tienda-acciones .btn { font-size: 0.78rem; } }

/* ===== Vista Campo: navegacion de semana (3 botones iguales: anterior · hoy · siguiente) ===== */
.week-nav { display: flex !important; align-items: stretch; gap: 8px; margin-bottom: 6px; flex-wrap: nowrap !important; }
.week-nav .week-btn {
  flex: 1 1 0% !important; min-width: 0 !important; width: auto !important;
  font-size: 0.95rem; padding: 10px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.week-nav-info { display: flex; justify-content: center; margin-bottom: 12px; }
.week-nav-info .semana-label { min-width: 0 !important; font-size: 1rem; text-align: center; }
@media (max-width: 600px) {
  .week-nav { gap: 6px; }
  .week-nav .week-btn { font-size: 1rem; padding: 12px 4px; }
  .week-nav-info .semana-label { font-size: 0.92rem; }
}

/* ===== Vista tienda: los 3 accesos al mapa en el hueco del boton Mapa ===== */
.hero-acciones-mapa {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; min-width: 0;
}
.hero-acciones-mapa .btn {
  width: 100%; min-width: 0; margin: 0; padding: 8px 4px; font-size: 0.8rem; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 430px) {
  .hero-acciones-mapa { gap: 5px; }
  .hero-acciones-mapa .btn { font-size: 0.72rem; padding: 9px 2px; }
}
