:root {
  --bg: #f4f6f9; --panel: #fff; --ink: #1d2733; --muted: #6b7785; --line: #e2e7ee;
  --brand: #1f5fa8; --brand-ink: #fff; --ok: #1e7d4f; --ok-bg: #e5f4ec; --err: #b42318; --err-bg: #fdecea;
  --warn: #8a5a00; --warn-bg: #fff4d6; --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .9em; margin: .25rem 0; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; font-size: 1.25rem; letter-spacing: .04em; color: var(--brand); text-decoration: none; }
.brand.big { font-size: 1.6rem; margin-bottom: .5rem; }
.who { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.shell { display: flex; min-height: calc(100vh - 54px); }
.sidebar { width: 210px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 1rem 0; }
.sidebar a { display: block; padding: .4rem 1.25rem; color: var(--ink); text-decoration: none; }
.sidebar a:hover { background: #f0f4fa; }
.sidebar a.active { background: #e8f0fb; color: var(--brand); font-weight: 600; border-left: 3px solid var(--brand); padding-left: calc(1.25rem - 3px); }
.side-group { margin: 1rem 1.25rem .25rem; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.content { flex: 1; padding: 1.5rem 2rem; min-width: 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.plain .narrow { max-width: 420px; margin: 8vh auto; }

.alert { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--err-bg); color: var(--err); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.pw { font-size: 1.1em; user-select: all; }

.form label { display: block; margin-bottom: .8rem; font-weight: 600; font-size: .92em; }
.form input, .form select, .form textarea, .filter {
  display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem; font: inherit; font-weight: 400;
  border: 1px solid #c9d2dd; border-radius: 6px; background: #fff;
}
.form input:focus, .form select:focus, .form textarea:focus, .filter:focus { outline: 2px solid #9cc0ea; border-color: var(--brand); }
.filter { max-width: 320px; margin-bottom: .75rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid2 .actions { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 1rem 1.25rem; margin: 0; }
legend { font-weight: 700; padding: 0 .4rem; }
.actions { display: flex; gap: .6rem; margin: 1rem 0; flex-wrap: wrap; }
.inline { display: inline; }

.btn { display: inline-block; padding: .5rem 1rem; border: 1px solid #c9d2dd; border-radius: 6px; background: #fff; color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f3f6fa; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); border-color: #f1b8b2; }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: #f7f9fc; font-size: .85em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .8em; font-weight: 600; }
.badge.on { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--err-bg); color: var(--err); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; text-decoration: none; color: var(--muted); }
.tile:hover { border-color: var(--brand); }
.tile .num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--ink); }

.details { display: grid; grid-template-columns: 200px 1fr; gap: .4rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; padding: .5rem; }
  .side-group { display: none; }
  .sidebar a { padding: .35rem .7rem; }
  .content { padding: 1rem; }
  .grid2 { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
}

/* Ficha de producto */
.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }
.toolbar .filter { margin: 0; width: auto; }
.product-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.product-actions { display: flex; gap: .6rem; align-items: center; }
.checklist { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: .6rem 1rem; margin-bottom: 1rem; font-size: .92em; }
.checklist .muted { color: #6f5a2a; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a { padding: .55rem 1rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.row, .row3 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 2fr 1fr 1fr; }
label.check { display: flex; gap: .45rem; align-items: center; font-weight: 400; margin: .2rem 0; }
.check input { width: auto; display: inline; margin: 0; }
span.check { display: flex; gap: .45rem; align-items: center; }
.checklist-box { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .6rem; }
.cat-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.services, .weekdays { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: center; margin: .5rem 0 1rem; }
.form textarea { resize: vertical; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }

.thumb { background: #eef2f7; border-radius: 6px; overflow: hidden; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.main { max-width: 240px; margin-bottom: .5rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.gitem { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; }
.gitem label { font-size: .85em; margin: .4rem 0 0; }
button.link.danger, .link.danger { color: var(--err); }

.season-box { margin-bottom: 1.25rem; }
.table.rates input { width: 100%; padding: .35rem .5rem; border: 1px solid #c9d2dd; border-radius: 5px; font: inherit; }
.table.rates td { padding: .35rem .5rem; }
.danger-zone { border-color: #f1b8b2; margin-top: 2rem; max-width: 720px; }
.pre { white-space: pre-wrap; }

@media (max-width: 800px) {
  .row, .row3, .cat-cols { grid-template-columns: 1fr; }
}

/* Importación */
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.form label .badge { margin-left: .35rem; vertical-align: 1px; }
.form label .hint { font-weight: 400; }
details.original { margin-bottom: 1.25rem; padding: .8rem 1.1rem; }
details.original summary { cursor: pointer; font-weight: 600; color: var(--brand); }
details.original pre { white-space: pre-wrap; font: .9em/1.5 ui-monospace, Menlo, Consolas, monospace; max-height: 420px; overflow: auto; margin: .75rem 0 0; }
legend.sub { display: block; font-weight: 700; margin: 1.25rem 0 .5rem; padding: 0; }
.table.compact th, .table.compact td { padding: .35rem .5rem; font-size: .9em; }
ul.tips { padding-left: 1.1rem; margin: 0; }
ul.tips li { margin-bottom: .45rem; }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }
label.gitem.pick { cursor: pointer; font-weight: 400; }
label.gitem.pick:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px #9cc0ea; }
label.gitem.pick .check { margin-top: .4rem; font-size: .85em; }
.pager { display: flex; gap: .75rem; align-items: center; margin: .75rem 0; flex-wrap: wrap; }
form.search { display: inline-flex; gap: .5rem; align-items: center; }
form.search .filter { margin: 0; width: 260px; }
.logo-box { max-width: 420px; margin: 1rem 0; }
img.logo { max-width: 220px; max-height: 120px; display: block; margin-bottom: .5rem; background: #f7f9fc; padding: .5rem; border-radius: 6px; }

/* Avisos del inicio */
.alerts-list { padding-left: 1.2rem; margin: .5rem 0 1.5rem; }
.alerts-list li { margin-bottom: .45rem; }

/* Galería: arrastrar para ordenar */
[data-sort-item] { cursor: grab; }
.gitem.dragging { opacity: .45; }

/* Vista previa de la ficha */
.preview-bar { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.preview { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; max-width: 860px; }
.preview-head h2 { font-size: 1.7rem; margin: .25rem 0 .5rem; }
.preview .lead { font-size: 1.1rem; }
.preview .facts { margin: .75rem 0 1.25rem; }
.preview-main { width: 100%; max-height: 460px; object-fit: cover; border-radius: var(--radius); }
.preview-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; margin: .75rem 0 1rem; }
.preview-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.preview-section { margin-top: 1.5rem; }
.preview-section h3 { font-size: 1.1rem; border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.preview-section h4 { margin: 1rem 0 .4rem; font-size: 1rem; }
.preview-section p, .preview-section ul { margin: .4rem 0; }
.preview-section ul { padding-left: 1.2rem; }

/* Impresión o PDF desde el navegador */
@media print {
  .topbar, .sidebar, .no-print, .toolbar, .tabs, .actions, .pager, .checklist, .alerts-list, .product-actions, form { display: none !important; }
  body { background: #fff; }
  .shell, .content { display: block; padding: 0; }
  .card, .table, .preview { border: 0; box-shadow: none; }
  a { color: #000; text-decoration: none; }
}

/* Utilidades (sustituyen a los estilos en línea: la CSP no permite style="") */
.mw-520 { max-width: 520px; } .mw-560 { max-width: 560px; } .mw-720 { max-width: 720px; } .mw-820 { max-width: 820px; }
.mt-0 { margin-top: 0; } .mt-6 { margin-top: 1.5rem; } .ml-0 { margin-left: 0; } .m-0 { margin: 0; }
.self-start { align-self: start; } .w-160 { width: 160px; } .w-auto { width: auto; }

/* Punto de enfoque de la imagen principal */
.focus-box { position: relative; display: inline-block; max-width: 240px; cursor: crosshair; }
.focus-box img { display: block; width: 100%; height: auto; border-radius: 6px; }
.focus-dot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
             border: 2px solid #fff; background: rgba(0, 0, 0, .4); pointer-events: none; }
.precio{color:#0b6b57;font-weight:700;white-space:nowrap}
.presentacion{font-size:1.05rem;line-height:1.6;border-left:4px solid #0b6b57;padding-left:14px;margin:18px 0}
.card-preview{width:240px;height:180px;object-fit:cover;border-radius:6px}

.list-thumb{width:72px;height:54px;object-fit:cover;border-radius:4px;display:block}
