:root {
  --cars-orange: #ff4500;
  --cars-orange-dark: #e63e00;
  --cars-orange-soft: #fff1e8;
  --bg: #ffffff;
  --card-bg: #ffffff;
  --soft-bg: #f9fafb;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 14px 34px rgba(17, 24, 39, 0.07);
  --shadow-soft: 0 8px 18px rgba(17, 24, 39, 0.045);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  color: var(--text);
  font-family: "Inter", Arial, Helvetica, sans-serif;
  padding: 18px;
}

.app-container {
  max-width: 980px;
  margin: 0 auto;
}

.app-header {
  text-align: center;
  padding: 22px 12px 28px;
}

.logo {
  width: 108px;
  height: auto;
  border-radius: 24px;
  margin-bottom: 14px;
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.12);
}

.app-header h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  color: var(--text);
  font-weight: 900;
  letter-spacing: -1.2px;
}

.app-header h1::after {
  content: "";
  display: block;
  width: 86px;
  height: 5px;
  border-radius: 999px;
  background: var(--cars-orange);
  margin: 14px auto 0;
}

.app-header p {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.4px;
}

.card h2::before {
  content: "";
  width: 8px;
  height: 28px;
  border-radius: 999px;
  background: var(--cars-orange);
  flex: 0 0 auto;
}

.card h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 900;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.section-subtitle {
  margin: -10px 0 18px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
}

.form-group {
  margin-bottom: 16px;
}

.form-group.full {
  width: 100%;
}

.mt-16 {
  margin-top: 18px;
}

label {
  display: block;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 8px;
  color: #374151;
  letter-spacing: -0.1px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-height: 50px;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
  background: #ffffff;
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  font-family: inherit;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cars-orange);
  box-shadow: 0 0 0 4px rgba(255, 69, 0, 0.14);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--cars-orange);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.vin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.btn {
  min-height: 50px;
  border-radius: var(--radius-sm);
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid var(--cars-orange);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 16px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
  text-align: center;
  font-family: inherit;
}

.btn svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.4;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cars-orange), #ff6a2b);
  color: white;
  box-shadow: 0 12px 22px rgba(255, 69, 0, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--cars-orange-dark), var(--cars-orange));
  border-color: var(--cars-orange-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  background: #ffffff;
  color: var(--cars-orange);
  box-shadow: var(--shadow-soft);
}

.btn-secondary:hover {
  background: var(--cars-orange-soft);
  transform: translateY(-2px);
}

.btn-large {
  width: 100%;
  min-height: 56px;
  font-size: 16px;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 11px;
}

.main-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 26px 0 42px;
}

.specs-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  margin-top: 10px;
  box-shadow: var(--shadow-soft);
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.spec-grid div {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.spec-grid span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.spec-grid strong {
  font-size: 15px;
  line-height: 1.35;
}

.option-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.option-row label {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
  text-align: center;
  margin: 0;
  cursor: pointer;
  background: white;
  box-shadow: 0 6px 14px rgba(17, 24, 39, 0.04);
}

.option-row input {
  width: auto;
  min-height: auto;
  margin-right: 7px;
  accent-color: var(--cars-orange);
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 11px;
}

.rating-card {
  min-height: 68px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  box-shadow: var(--shadow-soft);
  font-family: inherit;
}

.rating-card:hover {
  border-color: var(--cars-orange);
  background: var(--cars-orange-soft);
  transform: translateY(-2px);
}

.rating-card.selected {
  background: linear-gradient(135deg, var(--cars-orange), #ff6a2b);
  color: white;
  border-color: var(--cars-orange);
  box-shadow: 0 16px 28px rgba(255, 69, 0, 0.26);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.evidence-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.photo-box {
  position: relative;
  border: 1.5px dashed #cbd5e1;
  background: #ffffff;
  border-radius: 20px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
  box-shadow: var(--shadow-soft);
}

.photo-box:hover {
  border-color: var(--cars-orange);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.scan-card {
  border-color: rgba(255, 69, 0, 0.28);
}

.scan-photo {
  border-color: rgba(255, 69, 0, 0.35);
}

.photo-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.photo-box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.photo-box span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
  padding: 12px;
}

.photo-box span::before {
  content: "＋";
  display: block;
  color: var(--cars-orange);
  font-size: 28px;
  margin-right: 8px;
}

.delete-photo {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: rgba(220, 38, 38, 0.96);
  color: white;
  font-size: 22px;
  line-height: 1;
  display: none;
  z-index: 10;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(220, 38, 38, 0.30);
}

.floating-mic-btn {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 62px;
  height: 62px;
  border-radius: 22px;
  border: 1px solid rgba(255, 69, 0, 0.22);
  background: #ffffff;
  color: var(--cars-orange);
  z-index: 1000;
  box-shadow: 0 18px 38px rgba(17, 24, 39, 0.16);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.floating-mic-btn .mic-svg {
  width: 31px;
  height: 31px;
  color: var(--cars-orange);
  z-index: 2;
  display: block;
}

.floating-mic-btn:hover {
  background: var(--cars-orange);
  color: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 24px 48px rgba(255, 69, 0, 0.22);
}

.floating-mic-btn.listening {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
}

.floating-mic-btn.listening .mic-pulse {
  position: absolute;
  inset: -7px;
  border-radius: 26px;
  border: 2px solid rgba(239, 68, 68, 0.42);
  animation: micPulse 1.35s infinite;
}

.mic-tooltip {
  position: absolute;
  right: 72px;
  top: 18px;
  background: #111827;
  color: white;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  display: none;
  font-weight: 800;
}

.floating-mic-btn:hover .mic-tooltip,
.floating-mic-btn.listening .mic-tooltip {
  display: block;
}

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: white;
  padding: 13px 18px;
  border-radius: 14px;
  z-index: 2000;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
  text-align: center;
  font-weight: 800;
}

.toast.success {
  background: #047857;
}

.toast.error {
  background: #b91c1c;
}

.toast.info {
  background: #1d4ed8;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.76);
  color: white;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  backdrop-filter: blur(8px);
}

.spinner {
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255,255,255,0.35);
  border-top-color: var(--cars-orange);
  border-radius: 999px;
  animation: spin 1s linear infinite;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes micPulse {
  0% {
    transform: scale(0.92);
    opacity: 0.8;
  }
  80% {
    transform: scale(1.22);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 760px) {
  body {
    padding: 10px;
  }

  .app-header {
    padding-top: 18px;
  }

  .app-header h1 {
    font-size: 28px;
  }

  .card {
    padding: 18px;
    border-radius: 20px;
  }

  .grid-2,
  .grid-3,
  .photo-grid,
  .evidence-grid,
  .main-actions {
    grid-template-columns: 1fr;
  }

  .rating-grid {
    grid-template-columns: 1fr;
  }

  .vin-actions {
    grid-template-columns: 1fr 1fr;
  }

  .floating-mic-btn {
    top: 14px;
    right: 14px;
    width: 58px;
    height: 58px;
    border-radius: 20px;
  }

  .floating-mic-btn .mic-svg {
    width: 29px;
    height: 29px;
  }

  .mic-tooltip {
    display: none !important;
  }
}


/* Tarjetas IA modernas */
.ai-report-card {
  border-color: rgba(255, 69, 0, 0.18);
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.ai-panel {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.ai-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-panel h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
}

.ai-panel p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.btn-small {
  min-height: 40px;
  padding: 8px 11px;
  font-size: 13px;
  border-radius: 12px;
  flex: 0 0 auto;
}

.ai-panel textarea {
  min-height: 132px;
  background: #ffffff;
}

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

  .ai-panel-header {
    flex-direction: column;
  }

  .btn-small {
    width: 100%;
  }
}





/* Micrófono final v10 */
.floating-mic-btn {
  background: #ffffff !important;
  color: var(--cars-orange) !important;
  border-color: rgba(255, 69, 0, 0.22) !important;
}

.floating-mic-btn .mic-svg {
  color: var(--cars-orange) !important;
}

.floating-mic-btn:hover {
  background: #fff7ed !important;
  color: var(--cars-orange) !important;
}

.floating-mic-btn.listening {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  animation: micWorkingPulse 1.6s infinite !important;
}

.floating-mic-btn.listening .mic-svg {
  color: #ffffff !important;
}

.floating-mic-btn.listening::after {
  content: "REC";
  position: absolute;
  bottom: -8px;
  right: -6px;
  background: #111827;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  padding: 3px 6px;
  border-radius: 999px;
  box-shadow: 0 8px 16px rgba(17, 24, 39, 0.25);
}

.floating-mic-btn:not(.listening)::after {
  content: none !important;
}

.mic-target-active {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18) !important;
}

@keyframes micWorkingPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}








/* Botón Escanear VIN con input real dentro del botón */
.scan-vin-button {
  position: relative;
  overflow: hidden;
}

.scan-vin-button input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 20;
}

.scan-vin-button i,
.scan-vin-button svg {
  pointer-events: none;
}

.scan-vin-button {
  -webkit-tap-highlight-color: transparent;
}


/* Campo único de especificaciones Auto.dev */
#especificaciones {
  min-height: 190px;
  background: #ffffff;
  font-weight: 650;
  line-height: 1.55;
  white-space: pre-wrap;
}

#especificaciones[readonly] {
  cursor: default;
}
