:root {
  --bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #b91c1c;
  --primary-dark: #991b1b;
  --primary-soft: #fef2f2;
  --wa: #25d366;
  --wa-dark: #1da851;
  --ok: #166534;
  --ok-soft: #ecfdf5;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.page {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 8px 10px 14px;
}

/* —— Cabecera —— */
.hero {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.hero-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 8px;
}

.hero-text {
  min-width: 0;
}

.hero h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: #111827;
}

.hero p {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.35;
}

/* —— Tabs categoría —— */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.tab:hover {
  border-color: #fca5a5;
  color: var(--primary);
}

.tab.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.tab.is-active svg {
  stroke: #fff;
}

/* —— Búsqueda —— */
.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-bottom: 8px;
}

.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

#searchTramite {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px 7px 30px;
  font: inherit;
  font-size: 0.8125rem;
  color: inherit;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#searchTramite:focus {
  outline: none;
  border-color: #fca5a5;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.btn-clear {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.btn-clear:hover {
  border-color: #fca5a5;
  color: var(--primary);
}

/* —— Secciones —— */
.section-block {
  margin-bottom: 6px;
}

.section-block.is-hidden {
  display: none;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-label svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

/* —— Acordeón —— */
.tramite {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 6px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tramite:hover {
  border-color: #d1d5db;
}

.tramite[open] {
  border-color: #fecaca;
  box-shadow: 0 2px 8px rgba(185, 28, 28, 0.06);
}

.tramite.is-hidden {
  display: none;
}

.tramite > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  user-select: none;
}

.tramite > summary::-webkit-details-marker {
  display: none;
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.summary-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 0.2s;
}

.tramite[open] .summary-chevron {
  transform: rotate(90deg);
  color: var(--primary);
}

.summary-title {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  color: #111827;
}

.summary-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.price {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--wa);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

.btn-wa .wa-num {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.btn-wa svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.btn-wa:hover {
  background: var(--wa-dark);
}

.btn-wa:active {
  transform: scale(0.97);
}

/* —— Cuerpo acordeón (tipografía uniforme) —— */
.tramite-body {
  padding: 0 10px 10px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #374151;
}

.tramite-body p {
  margin: 8px 0 0;
  font-size: inherit;
  line-height: inherit;
}

.block-title {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 10px 0 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.block-title svg {
  width: 13px;
  height: 13px;
  color: var(--primary);
}

.tramite-body ul {
  margin: 0;
  padding-left: 18px;
  font-size: inherit;
}

.tramite-body li {
  margin-top: 3px;
  font-size: inherit;
}

.delivery {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.75rem;
  font-weight: 600;
}

.delivery svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.empty-state {
  display: none;
  text-align: center;
  padding: 20px 12px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.empty-state.is-visible {
  display: block;
}

.empty-state svg {
  width: 32px;
  height: 32px;
  margin-bottom: 6px;
  opacity: 0.5;
}

@media (max-width: 520px) {
  .summary-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  .btn-wa {
    padding: 5px 7px;
    gap: 4px;
  }

  .btn-wa .wa-num {
    font-size: 0.625rem;
  }
}

@media (max-height: 700px) {
  .page {
    padding: 6px 8px 10px;
  }

  .tramite > summary {
    padding: 6px 8px;
  }

  .tramite-body {
    padding: 0 8px 8px;
  }
}
