/* ═══════════════════════════════════════
   RESET & VARIABLES
═══════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --red: #e31e24;
  --red-dark: #b81519;
  --red-light: #fff0f0;
  --black: #0f0f0f;
  --dark: #1a1a1a;
  --gray-1: #f4f4f5;
  --gray-2: #e4e4e7;
  --gray-3: #a1a1aa;
  --gray-4: #71717a;
  --text: #18181b;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --blue: #2563eb;
  --orange: #ea580c;
  --purple: #7c3aed;
  --teal: #0891b2;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 16px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  --font: 'DM Sans', sans-serif;
  --font-display: 'Bebas Neue', cursive;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); background: #f1f1f3; color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }

/* ═══════════════════════════════════════
   TOPBAR
═══════════════════════════════════════ */
.topbar {
  background: var(--black);
  position: sticky; top: 0; z-index: 100;
  border-bottom: 2px solid rgba(227,30,36,.4);
}
.topbar-inner {
  max-width: 980px; margin: 0 auto;
  padding: 0 24px; height: 60px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.topbar-logo {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
}
.topbar-logo img { height: 38px; width: auto; filter: brightness(0) invert(1); }
.topbar-logo-text {
  font-family: var(--font-display);
  font-size: 1.5rem; color: #fff; letter-spacing: .02em; line-height: 1;
}
.topbar-logo-text span { color: var(--red); }
.btn-back {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px; background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px; text-decoration: none; font-size: .82rem; font-weight: 500;
  transition: all .2s; white-space: nowrap;
}
.btn-back:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ═══════════════════════════════════════
   HERO
═══════════════════════════════════════ */
.hero {
  background: var(--black);
  padding: 40px 24px 52px;
  text-align: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 80% at 50% 120%, rgba(227,30,36,.18) 0%, transparent 70%);
  pointer-events: none;
}
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(227,30,36,.15); border: 1px solid rgba(227,30,36,.3);
  color: #ff6b6b; border-radius: 20px;
  padding: 4px 14px; font-size: .78rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; margin-bottom: 16px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  color: #fff; letter-spacing: .04em; line-height: 1;
  margin-bottom: 12px;
}
.hero h1 span { color: var(--red); }
.hero p {
  color: rgba(255,255,255,.55); font-size: .95rem; max-width: 440px;
  margin: 0 auto; line-height: 1.6;
}

/* ═══════════════════════════════════════
   MAIN LAYOUT
═══════════════════════════════════════ */
.main {
  max-width: 980px; margin: 0 auto;
  padding: 32px 24px 60px;
}

/* ═══════════════════════════════════════
   TABS
═══════════════════════════════════════ */
.tabs-wrapper {
  background: var(--black);
  padding: 0 24px;
}
.tabs {
  max-width: 980px; margin: 0 auto;
  display: flex; gap: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 14px 22px;
  background: transparent; border: none; cursor: pointer;
  color: rgba(255,255,255,.45); font-family: var(--font);
  font-size: .88rem; font-weight: 600;
  border-bottom: 3px solid transparent;
  transition: all .2s; position: relative; top: 0;
  white-space: nowrap;
}
.tab-btn .tab-icon { font-size: 1rem; }
.tab-btn:hover { color: rgba(255,255,255,.75); }
.tab-btn.active { color: #fff; border-bottom-color: var(--red); }

/* ═══════════════════════════════════════
   TAB PANES
═══════════════════════════════════════ */
.tab-pane { display: none; animation: fadeIn .25s ease; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════════════════════
   SEARCH CARD
═══════════════════════════════════════ */
.search-card {
  background: #fff; border-radius: var(--radius);
  border: 1.5px solid var(--gray-2);
  padding: 28px; margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.search-label {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--gray-3); margin-bottom: 10px;
}
.search-row { display: flex; gap: 10px; }
.search-input {
  flex: 1; padding: 13px 18px;
  border: 1.5px solid var(--gray-2); border-radius: 10px;
  font-size: .95rem; font-family: var(--font);
  background: var(--gray-1); color: var(--text);
  transition: all .2s; outline: none;
  text-transform: uppercase;
}
.search-input::placeholder { text-transform: none; color: var(--gray-3); }
.search-input:focus { border-color: var(--red); background: #fff; box-shadow: 0 0 0 3px rgba(227,30,36,.1); }
.search-hint { margin-top: 10px; font-size: .79rem; color: var(--gray-3); line-height: 1.5; }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 13px 24px; background: var(--red);
  color: #fff; border: none; border-radius: 10px;
  font-weight: 700; font-size: .88rem; cursor: pointer;
  font-family: var(--font); text-decoration: none;
  transition: all .2s; white-space: nowrap;
  text-transform: uppercase; letter-spacing: .04em;
}
.btn:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(227,30,36,.3); }
.btn:active { transform: translateY(0); }
.btn-dark { background: var(--dark); }
.btn-dark:hover { background: #000; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.btn-green { background: #25D366; }
.btn-green:hover { background: #1fac55; box-shadow: 0 4px 12px rgba(37,211,102,.3); }
.btn-outline {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--gray-2);
  box-shadow: none;
}
.btn-outline:hover { background: var(--gray-1); box-shadow: none; transform: none; }
.btn-sm { padding: 8px 16px; font-size: .78rem; }

/* ═══════════════════════════════════════
   LOADING / EMPTY
═══════════════════════════════════════ */
.loading-box {
  background: #fff; border-radius: var(--radius);
  border: 1.5px solid var(--gray-2);
  padding: 48px; text-align: center; display: none;
}
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--gray-2);
  border-top-color: var(--red); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-box p { color: var(--gray-3); font-size: .9rem; }

.empty-box {
  background: #fff; border-radius: var(--radius);
  border: 1.5px solid var(--gray-2);
  padding: 60px 40px; text-align: center; display: none;
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-box h3 { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 8px; }
.empty-box p { color: var(--gray-4); font-size: .9rem; line-height: 1.6; }

/* ═══════════════════════════════════════
   ─── SEGUIMIENTO ───
   Result Card
═══════════════════════════════════════ */
.result-card {
  background: #fff; border-radius: var(--radius);
  border: 1.5px solid var(--gray-2);
  box-shadow: var(--shadow); overflow: hidden; display: none;
}

/* Vehicle Banner */
.veh-banner {
  background: var(--dark);
  padding: 24px 28px;
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 16px;
}
.veh-banner-name {
  font-family: var(--font-display);
  font-size: 1.8rem; color: #fff; line-height: 1; letter-spacing: .03em;
}
.veh-banner-meta {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; margin-top: 8px;
}
.plate-tag {
  background: var(--red); color: #fff;
  padding: 3px 12px; border-radius: 6px;
  font-weight: 700; letter-spacing: .12em; font-size: .88rem;
}
.veh-banner-sub { color: rgba(255,255,255,.45); font-size: .8rem; }
.status-pill {
  padding: 7px 18px; border-radius: 20px;
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #fff; flex-shrink: 0;
}

/* Tracking section label */
.section-label {
  padding: 18px 28px 0;
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--gray-3);
}

/* Timeline */
.timeline { padding: 20px 28px 24px; }
.step { display: flex; gap: 16px; }
.step-left { display: flex; flex-direction: column; align-items: center; min-width: 20px; }
.step-dot {
  width: 18px; height: 18px; border-radius: 50%;
  flex-shrink: 0; margin-top: 3px;
  transition: all .3s;
}
.step-dot.current {
  width: 22px; height: 22px; margin-top: 1px;
  box-shadow: 0 0 0 4px rgba(0,0,0,.1);
}
.step-line { width: 2px; flex: 1; min-height: 20px; margin: 5px 0; }
.step-content { flex: 1; padding-bottom: 22px; }
.step-title { font-weight: 600; font-size: .9rem; }
.step-title.muted { color: var(--gray-3); font-weight: 400; }
.step-time { font-size: .75rem; color: var(--gray-3); margin-top: 3px; }
.step-note {
  font-size: .83rem; color: #555;
  margin-top: 10px; background: var(--gray-1);
  padding: 11px 14px; border-radius: 8px;
  border-left: 3px solid var(--red); line-height: 1.5;
}

/* Meta row */
.meta-strip {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1.5px solid var(--gray-2);
  background: var(--gray-1);
}
.meta-item { padding: 16px 20px; border-right: 1px solid var(--gray-2); }
.meta-item:last-child { border-right: none; }
.meta-lbl { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--gray-3); }
.meta-val { font-size: .9rem; font-weight: 700; color: var(--text); margin-top: 4px; }

/* Ready Banner */
.ready-banner {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 28px;
  background: var(--green-light);
  border-top: 2px solid rgba(22,163,74,.25);
}
.ready-banner .ri { font-size: 2rem; }
.ready-banner strong { color: var(--green); display: block; font-size: .95rem; margin-bottom: 3px; }
.ready-banner small { color: var(--gray-4); font-size: .8rem; }

/* Actions */
.card-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 18px 28px; border-top: 1.5px solid var(--gray-2);
}

/* ═══════════════════════════════════════
   ─── HISTORIAL ───
═══════════════════════════════════════ */
/* Separadores de sección */
.section-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 32px 0 18px;
}
.section-divider-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.section-divider-text h2 {
  font-family: var(--font-display);
  font-size: 1.35rem; letter-spacing: .04em; line-height: 1;
}
.section-divider-text p { font-size: .78rem; color: var(--gray-4); margin-top: 2px; }
.section-divider-line { flex: 1; height: 1.5px; background: var(--gray-2); }

/* Veh card */
.veh-summary {
  background: var(--dark); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 24px;
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
}
.veh-summary-info { flex: 1; }
.veh-summary-name {
  font-family: var(--font-display); font-size: 1.7rem;
  color: #fff; line-height: 1; letter-spacing: .03em;
}
.veh-summary-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.veh-summary-sub { font-size: .8rem; color: rgba(255,255,255,.45); margin-top: 6px; }
.km-badge {
  background: rgba(227,30,36,.15); border: 1px solid rgba(227,30,36,.3);
  color: var(--red); padding: 8px 16px; border-radius: 10px;
  text-align: right; flex-shrink: 0;
}
.km-badge .km-val { font-family: var(--font-display); font-size: 1.6rem; line-height: 1; }
.km-badge .km-lbl { font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; }

/* Stats row */
.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border: 1.5px solid var(--gray-2);
  border-radius: 12px; padding: 18px 16px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-card .sv { font-family: var(--font-display); font-size: 1.8rem; line-height: 1; }
.stat-card .sl { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-3); margin-top: 4px; }

/* Active service alert */
.active-alert {
  border-radius: 12px; padding: 16px 20px;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.active-alert-icon { font-size: 1.8rem; flex-shrink: 0; }
.active-alert-body { flex: 1; }
.active-alert-tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px; }
.active-alert-name { font-weight: 700; font-size: .95rem; }
.active-alert-sub { font-size: .78rem; color: var(--gray-4); margin-top: 3px; }
.active-alert .btn { margin-left: auto; }

/* ──────── TIPO SEPARATORS ──────── */
.tipo-separator {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 14px;
}
.tipo-separator-badge {
  display: flex; align-items: center; gap: 7px;
  border-radius: 20px; padding: 5px 14px;
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  white-space: nowrap;
}
.tipo-mecanica { background: #fef3c7; color: #92400e; }
.tipo-estetica { background: #fce7f3; color: #9d174d; }
.tipo-separator-line { flex: 1; height: 1px; background: var(--gray-2); }

/* Service cards */
.service-card {
  background: #fff; border: 1.5px solid var(--gray-2);
  border-radius: 12px; margin-bottom: 10px;
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.service-card:hover { box-shadow: var(--shadow); }
.service-card-header {
  padding: 16px 18px;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px;
}
.service-code { font-family: 'Courier New', monospace; font-size: .82rem; color: var(--gray-4); }
.service-fecha { font-weight: 700; font-size: .88rem; color: var(--text); margin-top: 3px; }
.service-tecnico { font-size: .75rem; color: var(--gray-3); margin-top: 2px; }
.status-chip {
  padding: 4px 12px; border-radius: 20px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap; flex-shrink: 0;
}
.service-body { padding: 0 18px 16px; }
.service-name { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.service-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.service-tag {
  background: var(--gray-1); border: 1px solid var(--gray-2);
  border-radius: 6px; padding: 3px 10px;
  font-size: .75rem; color: var(--gray-4);
}
.service-notes {
  background: var(--gray-1); border-radius: 8px;
  padding: 10px 14px; font-size: .82rem; color: #555;
  border-left: 3px solid var(--gray-3); line-height: 1.5; margin-bottom: 10px;
}
.service-footer {
  padding: 12px 18px;
  background: var(--gray-1);
  border-top: 1px solid var(--gray-2);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
}
.service-monto { font-weight: 700; font-size: 1rem; color: var(--green); }
.service-km { font-size: .78rem; color: var(--gray-4); }

/* Next service card */
.next-service {
  background: var(--red-light); border: 1.5px solid rgba(227,30,36,.2);
  border-radius: 12px; padding: 16px 18px;
  margin-bottom: 10px;
}
.next-service-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.next-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0;
}
.next-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--red); }
.next-km { font-weight: 700; font-size: .95rem; color: var(--text); }
.next-desc { font-size: .82rem; color: var(--gray-4); margin-top: 3px; }

/* Appointment cards */
.appt-card {
  background: #fff; border: 1.5px solid var(--gray-2);
  border-radius: 12px; padding: 16px 18px;
  margin-bottom: 10px; box-shadow: var(--shadow-sm);
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 12px; flex-wrap: wrap;
}
.appt-date { font-weight: 700; font-size: .95rem; }
.appt-time { font-size: .78rem; color: var(--gray-3); margin-top: 2px; }
.appt-service { font-size: .85rem; color: var(--gray-4); margin-top: 6px; }

/* CTA block */
.cta-block {
  background: var(--dark); border-radius: var(--radius);
  padding: 24px; margin-top: 28px;
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 16px;
}
.cta-block-text h3 {
  font-family: var(--font-display); font-size: 1.3rem;
  color: #fff; letter-spacing: .04em;
}
.cta-block-text p { font-size: .82rem; color: rgba(255,255,255,.45); margin-top: 4px; }
.cta-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ═══════════════════════════════════════
   INFO CARDS (landing section)
═══════════════════════════════════════ */
.info-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-top: 32px;
}
.info-card {
  background: #fff; border: 1.5px solid var(--gray-2);
  border-radius: 12px; padding: 22px 18px;
  box-shadow: var(--shadow-sm);
}
.info-card-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; margin-bottom: 14px;
  background: var(--red-light);
}
.info-card h4 { font-weight: 700; font-size: .92rem; margin-bottom: 6px; }
.info-card p { font-size: .8rem; color: var(--gray-4); line-height: 1.55; }

/* ═══════════════════════════════════════
   FOOTER
═══════════════════════════════════════ */
.footer {
  background: var(--black);
  padding: 32px 24px; text-align: center;
  border-top: 1px solid rgba(255,255,255,.07);
}
.footer img {
  width: 56px; height: 56px; border-radius: 50%;
  opacity: .6; margin-bottom: 14px;
}
.footer p { color: rgba(255,255,255,.35); font-size: .82rem; line-height: 1.8; }
.footer a { color: var(--red); text-decoration: none; }
.footer a:hover { color: #ff6b6b; }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 768px) {
  .info-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr 1fr; }
  .meta-strip { grid-template-columns: 1fr 1fr; }
  .meta-item:nth-child(2) { border-right: none; }
  .meta-item:nth-child(3) { border-right: none; grid-column: 1/-1; border-top: 1px solid var(--gray-2); }
}

@media (max-width: 600px) {
  .topbar-logo-text { display: none; }
  .hero { padding: 28px 16px 40px; }
  .main { padding: 20px 14px 50px; }
  .tabs-wrapper { padding: 0 14px; }
  .tab-btn { padding: 12px 16px; font-size: .82rem; }

  .search-card { padding: 18px; }
  .search-row { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  .search-input { width: 100%; }

  .veh-banner { padding: 18px; }
  .veh-banner-name { font-size: 1.5rem; }
  .timeline { padding: 16px 18px 20px; }
  .section-label { padding: 14px 18px 0; }
  .meta-strip { grid-template-columns: 1fr 1fr; }
  .card-actions { padding: 14px 18px; flex-direction: column; }
  .card-actions .btn { width: 100%; justify-content: center; }

  .veh-summary { padding: 18px; flex-direction: column; }
  .km-badge { align-self: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat-card { padding: 14px 10px; }
  .stat-card .sv { font-size: 1.4rem; }
  .info-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 24px; }
  .cta-block { flex-direction: column; padding: 18px; }
  .cta-actions { width: 100%; flex-direction: column; }
  .cta-actions .btn { width: 100%; justify-content: center; }
  .meta-strip { grid-template-columns: 1fr; }
  .meta-item { border-right: none; border-bottom: 1px solid var(--gray-2); }
  .meta-item:last-child { border-bottom: none; }
  .active-alert .btn { width: 100%; justify-content: center; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid .stat-card:last-child { grid-column: 1/-1; }
}