/* ==========================================================================
   Plataforma Racderma — estilo minimal (claro / oscuro)
   Todos los colores salen de variables: cambiar el tema = cambiar variables.
   ========================================================================== */

:root {
  --bg: #F5F5F7;
  --side: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F0F0F2;
  --surface-3: #E8E8ED;
  --line: #E8E8ED;
  --line-2: #F0F0F2;
  --text: #1D1D1F;
  --text-2: #424245;
  --muted: #6E6E73;
  --accent: #0E7C72;
  --accent-hover: #0A5F57;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3F2EF;
  --ok: #248A3D;
  --ok-soft: #E8F5EC;
  --warn: #B25000;
  --warn-soft: #FDF0E3;
  --danger: #D70015;
  --danger-soft: #FDECEC;
  --placeholder: #C7C7CC;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, .08);
  --radius: 20px;
  --radius-sm: 12px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #000000;
  --side: #0B0B0C;
  --surface: #1C1C1E;
  --surface-2: #2C2C2E;
  --surface-3: #3A3A3C;
  --line: #2C2C2E;
  --line-2: #2C2C2E;
  --text: #F5F5F7;
  --text-2: #D1D1D6;
  --muted: #98989D;
  --accent: #3DC9B8;
  --accent-hover: #6FDCCF;
  --accent-ink: #00201C;
  --accent-soft: #12302C;
  --ok: #30D158;
  --ok-soft: #10301A;
  --warn: #FF9F0A;
  --warn-soft: #3A2606;
  --danger: #FF453A;
  --danger-soft: #3A1210;
  --placeholder: #48484A;
  --shadow: none;
  --shadow-lg: none;
  --shadow-hover: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: 0 0 auto; }
.muted { color: var(--muted); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; flex: 0 0 248px; width: 248px;
  background: var(--side); border-right: 1px solid var(--line); padding: 22px 14px;
  display: flex; flex-direction: column; gap: 22px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: var(--text); }
.brand img { width: 38px; height: 38px; border-radius: 50%; }
.brand b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.brand small { display: block; font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  font-size: 14px; color: var(--text); white-space: nowrap;
}
.nav a .ic { color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.is-active { background: var(--surface-2); font-weight: 600; }
.nav a.is-active .ic { color: var(--accent); }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 12px 6px; }
.nav-sub a { padding: 7px 12px; font-size: 13px; }
.userbox { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: 0 0 34px; }
.userbox .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.userbox .who a { color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox .who span { font-size: 12px; color: var(--muted); }
.iconbtn {
  width: 36px; height: 36px; border-radius: 50%; border: none; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.iconbtn:hover { background: var(--surface-3); color: var(--text); }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 12px 40px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.topbar .menu-btn { display: none; }
.content { padding: 16px 40px 72px; }
.container { max-width: 1160px; margin: 0 auto; display: flex; flex-direction: column; gap: 32px; }
.container > * { min-width: 0; }

/* ---------- Tema (selector claro/oscuro) ---------- */
.theme-switch { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); padding: 3px; border-radius: 999px; flex: 0 0 auto; }
.theme-switch button { width: 36px; height: 30px; border: none; border-radius: 999px; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.theme-switch button[aria-checked="true"] { background: var(--surface-3); color: var(--text); }
.side .theme-switch { display: none; align-self: flex-start; margin-left: 8px; }

/* ---------- Buscador ---------- */
.search { position: relative; flex: 1; max-width: 640px; }
.search-box {
  display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.search-box input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--text); font-size: 15px; }
.search-box kbd { font: inherit; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.search.lg .search-box { height: 60px; border-radius: 16px; padding: 0 20px; box-shadow: var(--shadow-lg); border-color: transparent; }
[data-theme="dark"] .search.lg .search-box { border-color: var(--line); }
.search.lg .search-box input { font-size: 17px; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 18px 48px rgba(0,0,0,.14); max-height: min(70vh, 560px); overflow-y: auto; padding: 8px; display: none; z-index: 50;
}
.search-results.open { display: block; }
.search-results h6 { margin: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text); font-size: 14px; }
.search-results a small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.search-results a:hover, .search-results a.is-focus { background: var(--surface-2); }
.search-results .empty { padding: 14px 10px; color: var(--muted); font-size: 14px; }

/* ---------- Tipografía y encabezados ---------- */
.hero h1 { font-size: 44px; line-height: 1.08; font-weight: 700; letter-spacing: -0.03em; }
.hero h1 span { color: var(--muted); }
.page-head { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.08; }
.page-head .sub { font-size: 16px; color: var(--muted); margin-top: 4px; }
.page-head .grow { flex: 1; min-width: 220px; }
.page-head .head-img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.page-head .head-logo { width: 96px; height: 96px; border-radius: 22px; object-fit: contain; background: #FFFFFF; padding: 10px; box-shadow: var(--shadow); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head h2 { font-size: 24px; font-weight: 700; }
.section-head span { font-size: 14px; color: var(--muted); }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs b { color: var(--text); font-weight: 500; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 24px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-cards-lg { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.tile {
  background: var(--surface); border-radius: var(--radius); padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 6px;
  color: var(--text); box-shadow: var(--shadow); transition: box-shadow .2s, background .2s;
}
.tile:hover { color: var(--text); box-shadow: var(--shadow-hover); }
[data-theme="dark"] .tile:hover { background: #242426; }
.tile b { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.tile span { font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }

.circles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 24px 8px; padding: 28px 20px; }
.circle { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text); text-align: center; }
.circle:hover { color: var(--text); }
.circle .ph { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.circle img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.circle:hover img { transform: scale(1.05); }
.circle span { font-size: 13px; font-weight: 500; line-height: 1.25; }
.initials { font-size: 22px; font-weight: 600; color: var(--muted); }

.pcard {
  background: var(--surface); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
  color: var(--text); box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s;
}
.pcard:hover { color: var(--text); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
[data-theme="dark"] .pcard:hover { background: #242426; }
.pcard .media { aspect-ratio: 1 / 1; margin: 10px 10px 0; border-radius: 14px; background: #FFFFFF; display: flex; align-items: center; justify-content: center; overflow: hidden; }
[data-theme="dark"] .pcard .media { background: #F5F5F7; }
.pcard .media img { width: 100%; height: 100%; object-fit: contain; }
.pcard .media.empty { background: var(--surface-2); color: var(--placeholder); }
.pcard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard .lab { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pcard .name { font-size: 15px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.pcard .meta { font-size: 13px; color: var(--muted); }
.pcard .foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pcard .price { font-size: 15px; font-weight: 600; }
.pcard.logo .media { background: #FFFFFF; padding: 18px; }
.pcard.medico .media, .detail .media.medico { background: var(--surface-2); }
.pcard.medico .media img, .detail .media.medico img { object-fit: cover; object-position: center top; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
/* Vista previa grande de la imagen al pasar el mouse (lista de productos) */
.hover-preview { position: fixed; z-index: 120; width: 280px; height: 280px; padding: 12px; background: #FFFFFF; border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0,0,0,.22); border: 1px solid var(--line); pointer-events: none; display: none; }
.hover-preview.on { display: block; }
.hover-preview img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Estatus / chips ---------- */
.status { font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--ok); } .status.warn { color: var(--warn); } .status.muted { color: var(--muted); } .status.danger { color: var(--danger); }
.pill { font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.muted { background: var(--surface-2); color: var(--muted); } .pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.chip { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
a.chip:hover { color: var(--text); background: var(--surface-2); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Control segmentado / pestañas ---------- */
.seg { display: inline-flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 12px; max-width: 100%; overflow-x: auto; align-self: flex-start; }
[data-theme="dark"] .seg { background: var(--surface); }
.seg button, .seg a {
  border: none; background: transparent; color: var(--text); font-size: 14px; font-weight: 600; padding: 8px 16px;
  border-radius: 9px; cursor: pointer; white-space: nowrap;
}
.seg button span, .seg a span { color: var(--muted); font-weight: 500; margin-left: 4px; }
.seg [aria-selected="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
[data-theme="dark"] .seg [aria-selected="true"] { background: var(--surface-3); }
[hidden] { display: none !important; }

/* ---------- Detalle ---------- */
.detail { display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.detail .media {
  flex: 1 1 360px; max-width: 520px; background: #FFFFFF; border-radius: 28px; aspect-ratio: 1 / 1; display: flex;
  align-items: center; justify-content: center; box-shadow: var(--shadow); overflow: hidden; position: relative;
}
.detail .media img { width: 100%; height: 100%; object-fit: contain; }
.detail .media.photo img { object-fit: cover; }
.detail .media.empty { background: var(--surface); color: var(--placeholder); }
.detail .info { flex: 1.2 1 380px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.detail h1 { font-size: 38px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.detail .lead { font-size: 18px; line-height: 1.5; color: var(--text-2); }
.detail .bigprice { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.detail .bigprice small { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.rows { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); }
.rows > div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; font-size: 14px; }
.rows > div:last-child { border-bottom: none; }
.rows > div > span:first-child { color: var(--muted); }
.rows .links { display: flex; gap: 6px 10px; flex-wrap: wrap; justify-content: flex-end; }
.rows .links a { font-weight: 500; }

.tabs-card { background: var(--surface); border-radius: 24px; padding: 24px 28px 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 22px; }
.tabs-card .seg { background: var(--surface-2); }
.rich { font-size: 16px; line-height: 1.65; color: var(--text); overflow-wrap: anywhere; }
.rich div, .rich p { margin: 0 0 6px; }
.rich ul, .rich ol { margin: 6px 0; padding-left: 22px; }
.rich li { margin: 2px 0; }

/* ---------- Tablas ---------- */
.table-wrap { position: relative; overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]::after { content: " ↕"; opacity: .4; }
.table td { padding: 10px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .thumb { width: 44px; height: 44px; border-radius: 10px; background: #FFFFFF; object-fit: contain; display: block; border: 1px solid var(--line-2); }
.table .thumb.empty { background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--placeholder); }
.table .t-name { font-weight: 600; color: var(--text); }
.table .t-name:hover { color: var(--accent); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.is-off td { opacity: .55; }

/* ---------- Filtros ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .input, .filters .select { height: 42px; }
.filters .input { flex: 1 1 260px; }
.count-note { font-size: 13px; color: var(--muted); }

/* ---------- Formularios ---------- */
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px;
  padding: 9px 12px; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.form { display: flex; flex-direction: column; gap: 28px; }
.form-cols { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.form-cols > .col-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.form-cols > .col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.group { display: flex; flex-direction: column; gap: 8px; border: none; margin: 0; padding: 0; min-width: 0; }
.group > legend, .group > .legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 16px 8px; text-transform: uppercase; letter-spacing: .06em; }
.group .hint { font-size: 13px; color: var(--muted); padding: 0 16px; }
.panel { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); }
.field { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.field:last-child { border-bottom: none; }
.field > label, .field > .label { flex: 0 0 170px; font-size: 15px; }
.field > .control { flex: 1; min-width: 0; }
.field.stack { flex-direction: column; align-items: stretch; gap: 8px; }
.field.stack > label { flex: none; font-weight: 600; }
.req { color: var(--danger); }
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field-grid > div { padding: 14px 20px; border-right: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; }
.field-grid > div:last-child { border-right: none; }
.field-grid label { font-size: 12px; color: var(--muted); }
.field-grid .input { border: none; padding: 0; font-size: 17px; box-shadow: none; background: transparent; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 44px; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); }

.radios { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; flex-wrap: wrap; }
.radios label { flex: 1; text-align: center; cursor: pointer; }
.radios input { position: absolute; opacity: 0; pointer-events: none; }
.radios span { display: block; font-size: 13px; font-weight: 500; padding: 7px 10px; border-radius: 7px; white-space: nowrap; }
.radios input:checked + span { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
[data-theme="dark"] .radios input:checked + span { background: var(--surface-3); }
.radios input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); }

.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: 0 0 46px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 14px; transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #FFF; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: #34C759; }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; padding: 16px 20px; }
.check { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.repeater .rep-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.repeater .rep-row > .grow { flex: 1 1 200px; min-width: 0; }
.repeater .rep-add { width: 100%; text-align: left; padding: 14px 20px; border: none; background: transparent; color: var(--accent); font-size: 15px; font-weight: 500; cursor: pointer; border-radius: 0 0 18px 18px; }
.repeater .rep-add:hover { background: var(--surface-2); }
.repeater .rep-empty { padding: 14px 20px; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--line-2); }

.editor { border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.editor-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px 8px 20px; border-bottom: 1px solid var(--line-2); }
.editor-bar b { font-size: 15px; }
.editor-bar .tools { display: flex; gap: 2px; }
.editor-bar .tools button { width: 32px; height: 30px; border: none; border-radius: 7px; background: transparent; color: var(--text); cursor: pointer; font-size: 14px; }
.editor-bar .tools button:hover { background: var(--surface-2); }
.editor-area { min-height: 110px; padding: 14px 20px; font-size: 15px; line-height: 1.6; outline: none; overflow-wrap: anywhere; }
.editor-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.editor-area ul, .editor-area ol { padding-left: 22px; margin: 4px 0; }

.dropzone {
  position: relative; aspect-ratio: 1 / 1; border-radius: 14px; border: 1.5px dashed var(--placeholder); background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px; cursor: pointer; overflow: hidden;
}
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #FFF; }
.dropzone .dz-text { position: relative; font-size: 14px; font-weight: 500; }
.dropzone .dz-text small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 4px; }
.dropzone.has-img .dz-text { display: none; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-change { font-size: 13px; text-align: center; color: var(--muted); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 15px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.actions-bar { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Mensajes ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; display: flex; gap: 10px; align-items: center; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.info { background: var(--accent-soft); color: var(--accent); }
.empty-state { padding: 48px 24px; text-align: center; color: var(--muted); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-state .ic { color: var(--placeholder); margin-bottom: 8px; }

/* ---------- Carrusel ---------- */
.carousel { position: relative; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.carousel .track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; flex: 1; }
.carousel .track::-webkit-scrollbar { display: none; }
.carousel .slide { flex: 0 0 100%; scroll-snap-align: start; }
.carousel .slide img { width: 100%; height: 100%; min-height: 200px; max-height: 300px; object-fit: cover; display: block; cursor: zoom-in; }
.carousel .bar { padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; }
.carousel .bar b { font-size: 14px; }
.carousel .dots { display: flex; gap: 6px; }
.carousel .dots button { width: 6px; height: 6px; border-radius: 3px; border: none; padding: 0; background: var(--surface-3); cursor: pointer; transition: width .2s; }
.carousel .dots button[aria-current="true"] { width: 18px; background: var(--text); }

/* Visor de imagen */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.86); z-index: 100; display: none; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }

/* ---------- Videos ---------- */
.video { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.video .frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video .frame img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .9; }
.video .frame button { position: absolute; inset: 0; border: none; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.video .frame button span { width: 64px; height: 64px; border-radius: 50%; background: rgba(0,0,0,.6); color: #FFF; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.video .frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .cap { padding: 12px 16px; font-size: 14px; font-weight: 500; }

/* ---------- Orden (drag & drop) ---------- */
.sortable { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.sort-item { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 8px; cursor: grab; user-select: none; position: relative; }
.sort-item:active { cursor: grabbing; }
.sort-item .pos { position: absolute; top: 14px; left: 14px; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 700; min-width: 24px; height: 24px; border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 0 6px; z-index: 2; }
.sort-item .media { aspect-ratio: 1/1; border-radius: 10px; background: #FFF; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.sort-item .media img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.sort-item .media.empty { background: var(--surface-2); color: var(--placeholder); }
.sort-item .name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.sort-item .select { height: 32px; font-size: 12px; padding: 4px 28px 4px 8px; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow-hover); }
.savebar { position: sticky; bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border-radius: 16px; padding: 12px 16px; box-shadow: 0 12px 40px rgba(0,0,0,.16); border: 1px solid var(--line); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 48px 16px; }
.auth .box { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.auth .logo { width: 88px; height: 88px; border-radius: 50%; }
.auth h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; text-align: center; }
.auth .sub { font-size: 16px; color: var(--muted); text-align: center; margin-top: 6px; }
.auth form { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.auth .stack { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid transparent; }
[data-theme="dark"] .auth .stack { border-color: var(--line); }
.auth .stack .f { padding: 10px 18px; display: flex; align-items: center; gap: 10px; }
.auth .stack .f + .f { border-top: 1px solid var(--line-2); }
.auth .stack .f > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.auth .stack label { font-size: 12px; color: var(--muted); }
.auth .stack input { border: none; outline: none; background: transparent; font-size: 17px; padding: 2px 0 4px; color: var(--text); width: 100%; }
.auth .btn-primary { height: 52px; border-radius: 14px; font-size: 17px; }
.auth footer { font-size: 12px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid > div:nth-child(2) { border-right: none; }
  .field-grid > div:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); }
}
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .25s ease; visibility: hidden; }
  .side.open { transform: none; visibility: visible; box-shadow: 0 0 60px rgba(0,0,0,.25); }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; display: none; }
  .scrim.open { display: block; }
  .topbar { padding: 10px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 12px 16px 56px; }
  .hero h1 { font-size: 32px; }
  .page-head h1, .detail h1 { font-size: 30px; }
  .field { flex-direction: column; align-items: stretch; gap: 8px; }
  .field > label, .field > .label { flex: none; font-size: 14px; color: var(--muted); }
  .tabs-card { padding: 18px; }
  .theme-switch { display: none; }
  .side .theme-switch { display: inline-flex; }
}
@media (max-width: 560px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 16px; }
  .tile b { font-size: 26px; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard .body { padding: 10px 12px 12px; }
  .pcard .name { font-size: 14px; }
  .circles { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 20px 8px; }
  .circle .ph { width: 64px; height: 64px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid > div { border-right: none !important; border-bottom: 1px solid var(--line-2); }
  .search kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .side, .topbar, .savebar { display: none !important; } body { background: #FFF; } }
