/* Panel de administración — Meu Pilates */
:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --surface-2: #f1ede6;
  --line: #e4ddd2;
  --text: #1b1917;
  --muted: #7a7166;
  --primary: #1b1917;
  --primary-text: #ffffff;
  --danger: #b4483a;
  --ok: #4d7a52;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(27,25,23,.06), 0 4px 16px rgba(27,25,23,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: 'Jost', system-ui, sans-serif; font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { font-weight: 500; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.boot { padding: 40px; color: var(--muted); }

/* Layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .logo { width: 150px; margin: 0 8px 22px; }
.side a.nav { text-decoration: none; padding: 10px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.side a.nav:hover { background: var(--surface-2); color: var(--text); }
.side a.nav.on { background: var(--primary); color: var(--primary-text); }
.side .user { margin-top: auto; padding: 12px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.side .user button { margin-top: 8px; }
.main { padding: 28px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.head .grow { flex: 1; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 2px; }
  .side .logo { width: 96px; margin: 0 10px 0 0; }
  .side a.nav { padding: 8px 10px; font-size: 14px; }
  .side .user { display: none; }
  .main { padding: 18px 16px 60px; }
}

/* Controles */
button, .btn { font: inherit; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: 99px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--text); }
button.primary, .btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
button.danger { color: var(--danger); }
button.ghost { border-color: transparent; background: transparent; }
button.sm, .btn.sm { padding: 5px 11px; font-size: 13px; }
button.icon { padding: 6px 9px; border-radius: 8px; }
button:disabled { opacity: .45; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--text); outline-offset: -1px; }
textarea { min-height: 70px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
.grid-f { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.span-all { grid-column: 1 / -1; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 99px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 14px; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.empty { padding: 36px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Media */
.media { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; background: var(--surface-2); }
.media-ph { display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.media-ph span { font-size: 22px; font-weight: 500; color: var(--muted); letter-spacing: .04em; }

/* Ejercicios */
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.ex { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: border-color .15s; }
.ex:hover { border-color: var(--text); }
.ex .th { aspect-ratio: 16/10; position: relative; }
.ex .th .tag { position: absolute; top: 8px; left: 8px; background: rgba(255,255,255,.92); font-size: 12px; padding: 2px 9px; border-radius: 99px; font-weight: 500; }
.ex .th .vid { position: absolute; top: 8px; right: 8px; background: rgba(27,25,23,.8); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 99px; }
.ex .b { padding: 11px 13px 13px; }
.ex h3 { font-size: 16px; }
.ex p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.ex.off { opacity: .5; }

/* Clases (lista) */
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.cl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.cl .st { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.cl .st span { display: inline-flex; align-items: center; gap: 5px; }
.cl .act { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }

/* Constructor */
.builder { display: grid; grid-template-columns: 270px 1fr; gap: 18px; align-items: start; }
.lib { position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.lib .list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; min-height: 120px; }
.li { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: grab; user-select: none; }
.li:hover { border-color: var(--text); }
.li .th { width: 46px; height: 36px; border-radius: 6px; overflow: hidden; flex: none; }
.li .th .media-ph span { font-size: 12px; }
.li .t { flex: 1; min-width: 0; }
.li .t b { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t small { color: var(--muted); font-size: 12px; }
.li .add { flex: none; }
.cols { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 320px; border-top: 4px solid var(--c, #999); }
.col.hl { outline: 2px solid var(--c); outline-offset: 2px; }
.col .ch { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 2px 4px 4px; }
.col .ch h3 { font-size: 16px; }
.col .drop { flex: 1; display: flex; flex-direction: column; gap: 7px; min-height: 200px; border-radius: 10px; }
.col .drop:empty::before { content: 'Arrastra ejercicios aquí'; color: var(--muted); font-size: 13px; text-align: center; border: 1.5px dashed var(--line); border-radius: 10px; padding: 40px 10px; }
.it { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; cursor: grab; }
.it .r1 { display: flex; align-items: center; gap: 8px; }
.it .num { width: 22px; height: 22px; border-radius: 50%; background: var(--c, #999); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none; }
.it .nm { flex: 1; min-width: 0; font-weight: 500; font-size: 14px; line-height: 1.2; }
.it .meta { font-size: 12px; color: var(--muted); margin: 4px 0 0 30px; }
.it .ed { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.it .ed input { padding: 6px 8px; font-size: 13px; }
.it .ed .w { grid-column: 1 / -1; }
.it .ed label { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.dirty { color: var(--danger); font-size: 13px; }
@media (max-width: 1100px) { .builder { grid-template-columns: 1fr; } .lib { position: static; max-height: 380px; } }

/* Programación */
.week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 8px; overflow-x: auto; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 240px; display: flex; flex-direction: column; }
.day.today { border-color: var(--text); }
.day .dh { padding: 10px 10px 6px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.day .dh b { font-weight: 500; }
.day .db { padding: 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ev { background: var(--surface-2); border-radius: 8px; padding: 7px 9px; font-size: 13px; cursor: pointer; border-left: 3px solid var(--text); }
.ev:hover { background: #e9e3da; }
.ev b { font-weight: 600; display: block; }
.ev.live { border-left-color: var(--ok); background: #e7efe6; }

/* Control */
.live-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.ctl-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ctl-bar .big { padding: 12px 20px; font-size: 16px; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.stc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; border-top: 4px solid var(--c); cursor: pointer; }
.stc.sel { outline: 2px solid var(--c); outline-offset: 2px; }
.stc .cd { font-size: 34px; font-weight: 300; font-variant-numeric: tabular-nums; margin: 6px 0 2px; }
.stc .ex-name { font-weight: 500; font-size: 17px; min-height: 24px; }
.stc .bar { height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.stc .bar i { display: block; height: 100%; background: var(--c); width: 0; }
.badge { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-weight: 500; }
.badge.live { background: #e7efe6; color: var(--ok); }
.badge.paused { background: #f6e6e3; color: var(--danger); }

/* Pantallas */
.tv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.tv-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; border-left: 4px solid var(--c); }
.tv-item code { font-size: 12px; background: var(--surface-2); padding: 6px 8px; border-radius: 6px; word-break: break-all; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(27,25,23,.45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 640px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .mh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal .mf { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal .mf .left { margin-right: auto; }
.media-field { display: flex; gap: 10px; align-items: center; }
.media-field .pv { width: 84px; height: 60px; border-radius: 8px; overflow: hidden; flex: none; }
.media-field input[type=file] { padding: 6px; font-size: 13px; }
.warn { background: #fbf1e3; color: #8a5a17; padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-top: 12px; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .box { background: var(--surface); padding: 34px; border-radius: 18px; box-shadow: var(--shadow); width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login img { width: 190px; align-self: center; margin-bottom: 10px; }
.err { color: var(--danger); font-size: 14px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 11px 20px; border-radius: 99px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); }
.toast.bad { background: var(--danger); }
