/* =========================================================================
   ALTA SERVICES — Modern App Design System (2026)
   Tokens from styles.css. Linear / Mercury inspired: calm, airy, one accent.
   ========================================================================= */

/* ---- App layout ---- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg-soft); }
.app-main  { flex: 1; padding: clamp(20px, 4vw, 40px) 0; }

/* ---- Modern glass header ---- */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(150%) blur(16px);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
  border-bottom: 1px solid var(--line);
  height: 60px; display: flex; align-items: center;
}
.app-header .wrap {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
}
.app-header-brand {
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: -.02em; color: var(--green); text-decoration: none;
  display: flex; align-items: center; gap: 10px;
}
.app-header-brand svg { width: 28px; height: 28px; flex-shrink: 0; }
.app-header-user {
  display: flex; align-items: center; gap: 12px;
  font-size: .85rem; color: var(--ink-soft);
}
.app-header-user strong { color: var(--ink); font-weight: 600; }
.app-header-logout {
  background: var(--bg-soft); color: var(--ink-soft); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 8px;
  font-family: var(--sans); font-size: .8rem; font-weight: 500;
  cursor: pointer; transition: all .2s;
}
.app-header-logout:hover { background: var(--green); color: #fff; border-color: var(--green); }

/* ---- Login ---- */
.login-wrap {
  max-width: 400px; margin: 0 auto;
  padding: clamp(60px, 10vw, 120px) 24px clamp(40px, 6vw, 80px);
}
.login-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: 20px; padding: 40px 32px;
  box-shadow: 0 4px 24px rgba(18,22,15,.06), 0 1px 3px rgba(18,22,15,.04);
}
.login-card h1 {
  font-size: 1.5rem; text-align: center; margin-bottom: 6px; color: var(--ink);
}
.login-card .lead {
  text-align: center; margin-bottom: 28px; font-size: .9rem; color: var(--muted);
}
.login-card .error-msg {
  background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 16px;
  font-size: .85rem; display: none;
}
.login-card .error-msg.visible { display: block; }

/* ---- Form fields ---- */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-family: var(--sans); font-weight: 500;
  font-size: .8rem; margin-bottom: 6px; color: var(--ink-soft);
}
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 10px; font-size: .92rem;
  font-family: var(--sans); background: #fff;
  transition: border-color .2s, box-shadow .2s;
  color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(31,161,96,.1);
}
.field textarea { resize: vertical; min-height: 80px; }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 24px;
  background: var(--green); color: #fff; border: none;
  border-radius: 10px; font-family: var(--sans);
  font-weight: 600; font-size: .92rem; cursor: pointer;
  transition: all .2s;
}
.btn-primary:hover { background: var(--green-dk); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(20,67,43,.25); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px;
  background: #fff; color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 10px; font-family: var(--sans);
  font-weight: 500; font-size: .85rem; cursor: pointer;
  transition: all .2s; text-decoration: none;
}
.btn-secondary:hover { background: var(--green); color: #fff; border-color: var(--green); }

.btn-sm { padding: 7px 14px; font-size: .8rem; border-radius: 8px; }

.btn-danger { background: #DC3545; color: #fff; border-color: #DC3545; }
.btn-danger:hover { background: #A71D2A; }

/* ---- Cards (universal) ---- */
.card {
  background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(18,22,15,.04);
  transition: box-shadow .25s, border-color .25s;
}
.card:hover { box-shadow: 0 4px 16px rgba(18,22,15,.07); }

/* ---- Status badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 99px;
  font-family: var(--sans); font-size: .75rem;
  font-weight: 600; letter-spacing: .01em;
  white-space: nowrap;
}
.badge-completed { background: #DCFCE7; color: #166534; }
.badge-in_progress { background: #FEF3C7; color: #92400E; }
.badge-open { background: #FEE2E2; color: #991B1B; }
.badge-resolved { background: #DCFCE7; color: #166534; }

/* ---- Dashboard components ---- */
.dash-welcome {
  margin-bottom: 24px;
}
.dash-welcome h2 {
  font-size: 1.4rem; font-weight: 700; color: var(--ink);
  margin-bottom: 4px; letter-spacing: -.02em;
}
.dash-welcome p {
  font-size: .9rem; color: var(--muted);
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.dash-stat {
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 20px;
  display: flex; flex-direction: column; gap: 2px;
  transition: border-color .2s, box-shadow .2s;
}
.dash-stat:hover { border-color: var(--mint-lt); box-shadow: 0 2px 12px rgba(20,67,43,.06); }
.dash-stat-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.dash-stat-icon.green { background: #DCFCE7; color: #166534; }
.dash-stat-icon.amber { background: #FEF3C7; color: #92400E; }
.dash-stat-icon.red { background: #FEE2E2; color: #991B1B; }
.dash-stat-icon.blue { background: #DBEAFE; color: #1E40AF; }
.dash-stat-icon.gray { background: var(--bg-soft); color: var(--muted); }
.dash-stat-value {
  font-family: var(--display); font-size: 1.8rem; font-weight: 700;
  color: var(--ink); line-height: 1.1; letter-spacing: -.03em;
}
.dash-stat-label {
  font-size: .8rem; color: var(--muted); font-weight: 400;
}

.dash-section {
  margin-bottom: 28px;
}
.dash-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.dash-section-title {
  font-family: var(--display); font-size: .75rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}

/* Photo strip */
.photo-strip {
  display: flex; gap: 10px; overflow-x: auto;
  padding: 2px 0 8px; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.photo-strip::-webkit-scrollbar { height: 0; }
.photo-strip-item {
  flex: 0 0 120px; scroll-snap-align: start;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: #fff;
  cursor: pointer; transition: transform .2s;
}
.photo-strip-item:hover { transform: scale(1.03); }
.photo-strip-item img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
}
.photo-strip-item .photo-strip-label {
  padding: 6px 8px; font-size: .7rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Progress bar (equipe) */
.round-progress-bar {
  background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 24px;
  margin-bottom: 20px;
}
.round-progress-info {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 12px;
}
.round-progress-label {
  font-family: var(--display); font-size: 1rem; font-weight: 600;
  color: var(--ink);
}
.round-progress-count {
  font-family: var(--display); font-size: .85rem; font-weight: 600;
  color: var(--green);
}
.round-progress-track {
  width: 100%; height: 8px; background: var(--bg-soft);
  border-radius: 99px; overflow: hidden;
}
.round-progress-fill {
  height: 100%; background: var(--green);
  border-radius: 99px; transition: width .5s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}

/* Hero action (equipe) */
.hero-action {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 18px 28px;
  background: var(--green); color: #fff; border: none;
  border-radius: 14px; font-family: var(--display);
  font-weight: 700; font-size: 1.05rem; cursor: pointer;
  transition: all .2s; margin-bottom: 24px;
  letter-spacing: -.01em;
  box-shadow: 0 4px 16px rgba(20,67,43,.2);
}
.hero-action:hover {
  background: var(--green-dk);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(20,67,43,.3);
}
.hero-action:active { transform: translateY(0); }
.hero-action:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.hero-action.done {
  background: #DCFCE7; color: #166534; box-shadow: none; cursor: default;
}
.hero-action.done:hover { transform: none; background: #DCFCE7; }

/* Empty state (improved) */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--muted);
}
.empty-state-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--bg-soft); display: flex;
  align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.empty-state-icon svg { width: 28px; height: 28px; }
.empty-state p { font-size: .92rem; max-width: 30ch; margin: 0 auto; }
.empty-state .btn-secondary { margin-top: 16px; }

/* ---- Visit card ---- */
.visit-card { cursor: pointer; margin-bottom: 12px; }
.visit-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
}
.visit-card-header h3 { font-size: .95rem; margin: 0; font-weight: 600; }
.visit-card-meta {
  color: var(--muted); font-size: .82rem;
  display: flex; gap: 16px; flex-wrap: wrap;
}
.visit-card-meta span { display: flex; align-items: center; gap: 5px; }
.visit-card-photos {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px; margin-top: 10px;
}
.visit-card-photos img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line);
}

/* ---- Photo grid (detail) ---- */
.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; margin-top: 18px;
}
.photo-item {
  border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; background: #fff;
}
.photo-item img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  cursor: pointer; transition: transform .2s;
}
.photo-item img:hover { transform: scale(1.02); }
.photo-item-label {
  padding: 10px 14px; font-size: .82rem;
  color: var(--ink-soft); font-weight: 500;
  display: flex; justify-content: space-between;
}
.photo-item-label time { color: var(--muted); font-weight: 400; }

/* ---- Visit detail ---- */
.visit-detail-header { margin-bottom: 24px; }
.visit-detail-header h2 { margin-bottom: 8px; }
.visit-detail-info {
  display: flex; gap: 16px; flex-wrap: wrap;
  color: var(--ink-soft); font-size: .88rem;
}

/* ---- Section title ---- */
.section-title {
  font-family: var(--display); font-size: 1.15rem; font-weight: 600;
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
  color: var(--ink); letter-spacing: -.02em;
}

/* ---- Ticket card ---- */
.ticket-card { margin-bottom: 12px; }
.ticket-card-header { display: flex; justify-content: space-between; align-items: center; }
.ticket-card-msg { color: var(--ink-soft); font-size: .9rem; margin-top: 8px; line-height: 1.5; }
.ticket-card img {
  margin-top: 10px; max-width: 280px; border-radius: 10px;
  border: 1px solid var(--line);
}

/* ---- Tabs ---- */
.tabs {
  display: flex; gap: 2px; margin-bottom: 24px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; width: fit-content;
}
.tab {
  padding: 8px 18px; border: none; border-radius: 10px;
  background: transparent; font-family: var(--sans);
  font-weight: 500; font-size: .85rem;
  color: var(--muted); cursor: pointer;
  transition: all .2s;
}
.tab.active {
  background: var(--green); color: #fff;
  box-shadow: 0 1px 4px rgba(20,67,43,.2);
}
.tab:hover:not(.active) { color: var(--ink); background: var(--bg-soft); }

/* ---- Staff: Round ---- */
.site-round-card { margin-bottom: 12px; }
.site-round-card h3 { font-size: 1rem; margin-bottom: 4px; font-weight: 600; }
.site-round-card .address { color: var(--muted); font-size: .85rem; }

.checkpoint-list { list-style: none; padding: 0; margin: 0; }
.checkpoint-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.checkpoint-item:last-child { border-bottom: none; }
.checkpoint-check {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line); display: flex;
  align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .25s;
}
.checkpoint-check.done {
  background: var(--green); border-color: var(--green); color: #fff;
}
.checkpoint-label { flex: 1; font-weight: 500; }
.checkpoint-btn {
  padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--green); font-family: var(--sans);
  font-size: .82rem; font-weight: 600; cursor: pointer; transition: all .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.checkpoint-btn:hover { background: var(--green); color: #fff; border-color: var(--green); }

/* ---- Lightbox ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.9); display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 95vw; max-height: 90vh; border-radius: 12px;
  object-fit: contain;
}
.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  background: rgba(255,255,255,.1); border: none; color: #fff;
  font-size: 1.6rem; cursor: pointer; line-height: 1;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.lightbox-close:hover { background: rgba(255,255,255,.2); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.4); display: none;
  align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 20px;
  padding: 32px; max-width: 480px; width: 100%;
  box-shadow: 0 24px 60px rgba(18,22,15,.18);
}
.modal h2 { font-size: 1.15rem; margin-bottom: 20px; color: var(--ink); }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;
}

/* ---- Loading ---- */
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--line);
  border-top-color: var(--green); border-radius: 50%;
  animation: spin .7s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: #fff; padding: 12px 24px;
  border-radius: 12px; font-family: var(--sans);
  font-size: .88rem; font-weight: 500;
  box-shadow: 0 8px 32px rgba(18,22,15,.2);
  opacity: 0; transition: opacity .3s, transform .3s;
  pointer-events: none; z-index: 600;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Site filter ---- */
.site-filter-select {
  padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 10px; font-family: var(--sans);
  font-size: .85rem; background: #fff; color: var(--ink);
  cursor: pointer; transition: border-color .2s;
}
.site-filter-select:focus {
  outline: none; border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(31,161,96,.1);
}

/* ---- Divider ---- */
.section-divider {
  height: 1px; background: var(--line); margin: 28px 0; border: none;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .app-header { height: 52px; }
  .app-header-brand { font-size: .95rem; }
  .app-header-brand svg { width: 24px; height: 24px; }
  .app-header-user span { display: none; }
  .app-header-logout { padding: 5px 12px; font-size: .78rem; }
  .login-card { padding: 28px 20px; border-radius: 16px; }
  .login-wrap { padding: clamp(40px, 8vw, 80px) 16px; }
  .card { padding: 16px; border-radius: 14px; }
  .photo-grid { grid-template-columns: 1fr; }
  .visit-card-photos { grid-template-columns: repeat(3, 1fr); }
  .tabs { width: 100%; overflow-x: auto; }
  .tab { font-size: .82rem; padding: 7px 14px; }
  .dash-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dash-stat { padding: 16px; }
  .dash-stat-value { font-size: 1.5rem; }
  .dash-stat-icon { width: 32px; height: 32px; margin-bottom: 10px; }
  .hero-action { padding: 16px 24px; font-size: .95rem; }
  .round-progress-bar { padding: 18px; }
  .section-title { font-size: 1.05rem; }
  .photo-strip-item { flex: 0 0 100px; }
  .modal { padding: 24px 20px; border-radius: 16px; }
  .checkpoint-btn { padding: 7px 12px; font-size: .78rem; }
}

@media (max-width: 380px) {
  .dash-grid { grid-template-columns: 1fr; }
  .tabs { gap: 0; padding: 3px; }
  .tab { padding: 7px 12px; font-size: .8rem; }
}
