:root {
  --bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #b91c1c;
  --primary-dark: #991b1b;
  --primary-soft: #fef2f2;
  --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;
}

.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 {
  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;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto 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;
}

#searchHerramienta {
  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;
}

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

.btn-tool {
  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-tool:hover {
  border-color: #fca5a5;
  color: var(--primary);
}

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

.section-block + .section-block {
  margin-top: 10px;
}

.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);
}

.herramienta {
  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;
}

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

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

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

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

.herramienta > 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;
}

.herramienta[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;
}

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

.herramienta-body {
  padding: 0 10px 10px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #374151;
}

.herramienta-tagline {
  margin: 8px 0 0;
  font-size: inherit;
  font-weight: 700;
  font-style: italic;
  color: #111827;
}

.herramienta-desc {
  margin: 6px 0 0;
  font-size: inherit;
  line-height: inherit;
}

.herramienta-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.herramienta-body a.btn-use,
.herramienta-body a.btn-use:hover,
.herramienta-body a.btn-use:focus,
.herramienta-body a.btn-use:active,
.herramienta-body a.btn-use:visited,
a.btn-use-mini,
a.btn-use-mini:hover,
a.btn-use-mini:focus,
a.btn-use-mini:active,
a.btn-use-mini:visited {
  color: #ffffff;
  text-decoration: none;
}

a.btn-use-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--primary);
  font-size: 0.6875rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

a.btn-use-mini:hover {
  background: var(--primary-dark);
}

a.btn-use-mini svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  stroke: #ffffff;
}

.herramienta-body a.btn-use {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--primary);
  font-size: 0.8125rem;
  font-weight: 700;
  transition: background 0.15s;
}

.herramienta-body a.btn-use:hover {
  background: var(--primary-dark);
}

.herramienta-body a.btn-use svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: #ffffff;
}

.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: 640px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .summary-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }

  a.btn-use-mini .lbl-mini {
    display: none;
  }
}

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

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

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