/* ============================================
   Súper Carnes · Herramienta interna
   Sistema de diseño compartido
   ============================================ */
@import url("https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Inter:wght@400;500;600&display=swap");

:root {
  --bg: #f1f3f9;
  --surface: #ffffff;
  --surface-2: #e9ecf5;
  --text: #141832;
  --muted: #5a6178;
  --accent: #e11d48;
  --accent-2: #be123c;
  --accent-soft: #fde8ef;
  --cyan: #0891b2;
  --border: #e3e6f0;
  --shadow-sm: 0 1px 2px rgba(20, 24, 50, 0.06);
  --shadow: 0 12px 28px -12px rgba(20, 24, 50, 0.22);
  --radius: 14px;
  --radius-lg: 20px;
  --topbar: 62px;
  --font-head: "Sora", sans-serif;
  --font-body: "Inter", sans-serif;
}

[data-theme="dark"] {
  --bg: #0d1024;
  --surface: #171b33;
  --surface-2: #1f2442;
  --text: #eef0fb;
  --muted: #9aa1c4;
  --accent: #fb7185;
  --accent-2: #f43f5e;
  --accent-soft: rgba(244, 63, 94, 0.16);
  --cyan: #22d3ee;
  --border: #262c4d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  padding-top: var(--topbar);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
table { border-collapse: collapse; }

/* ============ TOPBAR ============ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar);
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.topbar__inner {
  width: min(1180px, 94%);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  white-space: nowrap;
}
.topbar__brand-badge {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.topbar__spacer { flex: 1; }

.search-box {
  position: relative;
  flex: 1;
  max-width: 380px;
  margin-left: auto;
}
.search-box svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box input::placeholder { color: var(--muted); }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); transform: translateY(-1px); }

/* ============ CONTENEDOR Y MIGAS ============ */
.container { width: min(1180px, 94%); margin: 0 auto; }

.page-head { padding: 26px 0 6px; }
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--accent); font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--muted); margin: 0 6px; }

.page-title {
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.page-title::before {
  content: "";
  width: 8px; height: 34px;
  border-radius: 6px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.page-desc { color: var(--muted); margin-top: 8px; font-size: 0.98rem; }

/* ============ BOTONES ============ */
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 20px 0; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); background: var(--surface-2); }
.btn--primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: 0; }
.btn--primary:hover { background: linear-gradient(135deg, var(--accent-2), var(--accent-2)); }

/* ============ ESTRUCTURA DE PÁGINAS CONVERTIDAS ============ */
.page-content { padding-bottom: 10px; }
.page-content h2,
.page-content h3 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-content h2 { font-size: 1.1rem; margin: 28px 0 12px; }
.page-content h3 {
  font-size: 0.9rem;
  margin: 24px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.page-content h3::before {
  content: "";
  width: 6px; height: 16px;
  border-radius: 4px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.page-content p { color: var(--muted); margin: 10px 0; font-size: 0.95rem; }
.page-content img { display: none !important; }

table.data small { color: var(--muted); font-size: 0.85em; }
table.data b, table.data strong { font-weight: 600; }
table.data u { text-decoration-color: var(--accent); }

/* Filas que actúan como encabezado de sección (una sola celda) */
table.data tbody tr td:only-child {
  background: linear-gradient(90deg, var(--accent-soft), transparent) !important;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  padding: 10px 16px;
}

/* ============ SECCIONES Y TÍTULOS ============ */
.section-block { margin: 26px 0; }
.section-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.section-title::before {
  content: "";
  width: 6px; height: 20px;
  border-radius: 4px;
  background: linear-gradient(var(--accent), var(--accent-2));
}

/* ============ TARJETA / TABLA ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 22px;
}
.card__body { padding: 20px; }
.card__title { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.card__subtitle { font-size: 0.9rem; color: var(--muted); margin-bottom: 14px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.data {
  width: 100%;
  min-width: 460px;
  font-size: 0.92rem;
  border-collapse: separate;
  border-spacing: 0;
}
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background 0.15s; }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data tbody tr:nth-child(even) td { background: rgba(127, 138, 180, 0.05); }
table.data tbody tr:hover td { background: transparent; }
table.data a { color: var(--accent); font-weight: 600; }
table.data a:hover { text-decoration: underline; }

/* Fila de categoría dentro de tablas */
table.data tr.section-row td {
  background: linear-gradient(90deg, var(--accent-soft), transparent) !important;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 9px 16px;
}

/* Compatibilidad con clases antiguas */
.centrar { text-align: center; }
.alinear { text-align: left; }
.margen { text-align: left; }
.cabezal { text-align: left; }
.fila { font-weight: 500; }
.color { font-weight: 700; color: var(--accent); }
.fuente { font-size: 0.82rem; }
.size { font-size: 0.8rem; color: var(--muted); }
.texto { font-weight: 500; }

/* Tooltip simple (márgenes) */
.tooltip {
  position: relative;
  cursor: help;
  display: inline-block;
  font-weight: 600;
  color: var(--accent);
}
.tooltip i { font-style: normal; }
.tooltip i::after { content: " ℹ"; }
.tooltip-box,
.tooltip-boxx,
.tooltip-boxxx,
.computadora-box {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 260px;
  max-width: 320px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text);
  white-space: normal;
}
.tooltip-box b, .tooltip-boxx b, .tooltip-boxxx b, .computadora-box b {
  display: block;
  font-weight: 500;
}
.tooltip:hover .tooltip-box,
.tooltip:hover .tooltip-boxx,
.tooltip:hover .tooltip-boxxx,
.computadora:hover .computadora-box { display: block; }
.computadora { position: relative; cursor: help; font-weight: 600; color: var(--accent); }

/* ============ GRILLA DE TARJETAS / MENÚ ============ */
.grid-cards { display: grid; gap: 1rem; }
.grid-cards--2 { grid-template-columns: repeat(2, 1fr); }
.grid-cards--3 { grid-template-columns: repeat(3, 1fr); }
.grid-cards--4 { grid-template-columns: repeat(4, 1fr); }

.tile {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent); }
.tile__icon {
  width: 46px; height: 46px;
  flex-shrink: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.tile__name { font-family: var(--font-head); font-weight: 700; font-size: 0.95rem; line-height: 1.25; }
.tile__desc { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

/* ============ PANEL CON SIDEBAR (dashboard) ============ */
.dash { display: grid; grid-template-columns: 250px 1fr; gap: 24px; padding: 26px 0 60px; align-items: start; }

.sidebar {
  position: sticky;
  top: calc(var(--topbar) + 18px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.sidebar__title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 6px 10px 10px;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.sidebar a:hover { background: var(--accent-soft); color: var(--accent); }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.dash__content { min-width: 0; }

/* ============ HERO DASHBOARD ============ */
.dash-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 34px;
  margin-bottom: 22px;
  background:
    radial-gradient(600px 300px at 90% -20%, rgba(244, 63, 94, 0.4), transparent 60%),
    linear-gradient(135deg, #141832, #232a54);
  color: #fff;
}
.dash-hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.78rem;
  font-weight: 600;
  color: #fecdd3;
  margin-bottom: 14px;
}
.dash-hero h1 { font-family: var(--font-head); font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; letter-spacing: -0.02em; }
.dash-hero p { color: #b9bfe0; font-size: 0.98rem; margin-top: 8px; max-width: 540px; }

/* ============ ESTADO VACÍO / BÚSQUEDA ============ */
.search-empty {
  display: none;
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.search-empty.visible { display: block; }

/* ============ BOTÓN VOLVER ARRIBA ============ */
.back-top {
  position: fixed;
  right: 20px; bottom: 20px;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  z-index: 90;
}
.back-top.visible { opacity: 1; visibility: visible; transform: none; }

/* ============ PIE ============ */
.page-footer { text-align: center; padding: 30px 0 50px; color: var(--muted); font-size: 0.85rem; }
.page-footer a { color: var(--accent); font-weight: 500; }

/* ============ RESPONSIVO ============ */
@media (max-width: 980px) {
  .dash { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .grid-cards--4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cards--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-cards--2, .grid-cards--3, .grid-cards--4 { grid-template-columns: 1fr; }
  .search-box { max-width: 100%; }
  .dash-hero { padding: 24px; }
  .topbar__brand span { display: none; }
}
