/* Pantallas La Providencia — mobile-first, paleta dulcería */
:root {
  --rojo: #8B1E24;
  --rojo-osc: #6d1319;
  --crema: #FBF4E6;
  --carbon: #2b2b2b;
  --ok: #2e7d32;
  --warn: #b26a00;
  --err: #c62828;
  --borde: #e2d9c6;
}
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--crema);
  color: var(--carbon);
}

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: #fff; border-radius: 16px; padding: 32px 24px; width: 100%; max-width: 360px; box-shadow: 0 8px 30px rgba(0,0,0,.12); text-align: center; }
.login-card h1 { color: var(--rojo); margin: 0 0 4px; font-size: 1.5rem; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

/* ---------- layout ---------- */
header { background: var(--rojo); color: #fff; padding: 12px 16px 0; position: sticky; top: 0; z-index: 10; }
header h1 { margin: 0 0 8px; font-size: 1.1rem; }
nav { display: flex; gap: 4px; overflow-x: auto; }
nav button, nav a {
  background: transparent; border: none; color: #f6d9c4; padding: 10px 14px;
  font-size: .95rem; cursor: pointer; border-radius: 8px 8px 0 0; text-decoration: none; white-space: nowrap;
}
nav button.active { background: var(--crema); color: var(--rojo); font-weight: 700; }
section { padding: 16px; max-width: 1100px; margin: 0 auto; }

/* ---------- componentes ---------- */
.banner { padding: 10px 14px; border-radius: 8px; margin: 8px 16px; cursor: pointer; }
.error { color: #fff; background: var(--err); }
p.error:not(.banner) { background: transparent; color: var(--err); }
.okmsg { color: #fff; background: var(--ok); }
.muted { color: #7a7365; font-size: .88rem; }
.warn { color: var(--warn); font-size: .85rem; margin: 4px 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.grow { flex: 1; min-width: 120px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

button, .btn { font: inherit; }
.btn {
  display: inline-block; background: #fff; border: 1px solid var(--borde); color: var(--carbon);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; text-decoration: none;
}
.btn.primary, .login-card button { background: var(--rojo); border-color: var(--rojo); color: #fff; border-radius: 10px; padding: 10px 16px; cursor: pointer; border-style: solid; }
.btn.danger { color: var(--err); border-color: #e8b5b5; }
.btn.small { padding: 5px 9px; font-size: .85rem; }
.row.small, label.small { font-size: .82rem; }
input, select {
  font: inherit; padding: 9px 10px; border: 1px solid var(--borde); border-radius: 8px; background: #fff; max-width: 100%;
}
label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
label.row, label.btn { flex-direction: row; align-items: center; }
.title-edit { border: 1px solid transparent; background: transparent; font-weight: 700; padding: 6px 8px; border-radius: 6px; width: 100%; }
.title-edit:hover, .title-edit:focus { border-color: var(--borde); background: #fff; }

/* ---------- grid de tarjetas ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { background: #fff; border: 1px solid var(--borde); border-radius: 14px; overflow: hidden; }
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.card.block { padding: 16px; margin-bottom: 14px; }
.thumb-wrap { position: relative; aspect-ratio: 16/9; background: #1c1c1c; }
.thumb-wrap.vertical { aspect-ratio: 16/9; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: contain; }
.chip {
  position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.65); color: #fff;
  font-size: .75rem; padding: 3px 8px; border-radius: 20px;
}
.chip.dur { left: auto; right: 8px; }

/* ---------- semáforo ---------- */
.sem { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.sem-verde { background: #43a047; box-shadow: 0 0 6px #43a047; }
.sem-amarillo { background: #fbc02d; }
.sem-rojo { background: #e53935; }
.paircode { text-align: center; background: var(--crema); border-radius: 10px; padding: 10px; margin-top: 8px; }
.paircode span { font-size: 2.2rem; font-weight: 800; letter-spacing: .35em; color: var(--rojo); }

/* ---------- playlist editor ---------- */
.editor { background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 16px; }
.sortlist, .rulelist { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sortlist li, .rulelist li {
  display: flex; align-items: center; gap: 10px; background: var(--crema);
  border: 1px solid var(--borde); border-radius: 10px; padding: 8px 10px;
}
.sortlist img { width: 64px; height: 36px; object-fit: cover; border-radius: 6px; }
.handle { cursor: grab; color: #a89f8d; touch-action: none; font-size: 1.2rem; padding: 4px; }
.rule-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0 14px; }
.previewlist { background: var(--crema); border-radius: 10px; padding: 10px 10px 10px 34px; }

/* ---------- progreso / disco ---------- */
.progress { position: relative; background: #eee; border-radius: 8px; height: 26px; margin-bottom: 12px; overflow: hidden; }
.progress-bar { background: var(--ok); height: 100%; transition: width .2s; }
.progress span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.diskbar { background: #eee; border-radius: 8px; height: 14px; overflow: hidden; }
.diskbar div { background: var(--ok); height: 100%; }
.diskbar div.danger { background: var(--err); }

dialog { border: none; border-radius: 12px; padding: 8px; max-width: 92vw; }
dialog::backdrop { background: rgba(0,0,0,.7); }

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .video-card .card-body { padding: 8px; }
}
