/* ============================================================
   Escritorio (Admin) — estilos
   ============================================================ */
body.admin { background: var(--paper); color: var(--ink); }
.app { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.nav { background: var(--ppi-green-900); color: #fff; padding: 28px 20px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.nav-logo { width: 130px; margin: 6px 12px 28px; }
.nav-group-label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ppi-green-300); font-weight: 700; margin: 18px 12px 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; cursor: pointer; font-size: 16px; font-weight: 600; color: #cfe2da; border: none; background: none; width: 100%; text-align: left; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--ppi-green); color: #fff; }
.nav-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: .55; flex: none; }
.nav-spacer { flex: 1; }
.nav-cta { margin: 6px 4px 0; }

/* ---------- Main ---------- */
.main { padding: 40px 48px 80px; max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 30px; gap: 24px; flex-wrap: wrap; }
.page-title { font-family: var(--font-head); font-weight: 900; font-size: 40px; letter-spacing: -.01em; }
.page-sub { color: var(--ppi-gray-10); font-size: 16px; margin-top: 6px; max-width: 640px; line-height: 1.4; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-body); font-weight: 700; font-size: 15px; padding: 12px 22px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; transition: all .15s; text-decoration: none; }
.btn-primary { background: var(--ppi-green); color: #fff; }
.btn-primary:hover { background: var(--ppi-green-600); }
.btn-ghost { background: #fff; color: var(--ppi-green); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ppi-green); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #25292a; }
.btn-danger { background: #fff; color: var(--ppi-gray-10); border-color: var(--line); }
.btn-danger:hover { color: var(--ppi-green-900); border-color: var(--ppi-gray-7); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Tarjetas / listas ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.card-pad { padding: 26px 28px; }
.list { display: flex; flex-direction: column; gap: 14px; }
.row-card { display: flex; gap: 20px; align-items: center; background: #fff; border: 1px solid var(--line); border-left: 8px solid var(--ppi-green); border-radius: var(--r-md); padding: 18px 22px; box-shadow: var(--shadow-1); }
.row-card.inactive { opacity: .55; border-left-color: var(--ppi-gray-7); }
.row-thumb { width: 92px; height: 70px; border-radius: 8px; object-fit: cover; flex: none; background: var(--paper-2); }
.row-thumb.ph { display: flex; align-items: center; justify-content: center; background-image: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(99,101,105,.12) 8px 16px); font-size: 10px; color: var(--ppi-gray-10); font-weight: 700; letter-spacing: .1em; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-family: var(--font-head); font-weight: 700; font-size: 20px; line-height: 1.1; }
.row-meta { color: var(--ppi-gray-10); font-size: 14px; margin-top: 5px; display: flex; gap: 14px; flex-wrap: wrap; }
.row-snip { color: var(--ppi-gray-10); font-size: 14px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 560px; }
.row-actions { display: flex; gap: 8px; flex: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--paper-2); color: var(--ppi-gray-10); }
.pill-green { background: rgba(24,86,64,.12); color: var(--ppi-green); }
.pill-warn { background: var(--ink); color: #fff; }

.empty { text-align: center; padding: 60px 20px; color: var(--ppi-gray-10); border: 2px dashed var(--line); border-radius: var(--r-md); }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.col-2 { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 700; color: var(--ppi-gray-10); letter-spacing: .02em; text-transform: uppercase; }
.field input[type=text], .field input[type=number], .field input[type=date], .field input[type=time], .field select, .field textarea {
  font-family: var(--font-body); font-size: 16px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); width: 100%;
}
.field textarea { resize: vertical; min-height: 96px; line-height: 1.4; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ppi-green); box-shadow: 0 0 0 3px rgba(24,86,64,.12); }
.field .hint { font-size: 12px; color: var(--ppi-gray-7); font-weight: 500; text-transform: none; letter-spacing: 0; }

.uploader { display: flex; align-items: center; gap: 16px; }
.uploader-prev { width: 120px; height: 84px; border-radius: 8px; object-fit: cover; border: 2px solid var(--line); background: var(--paper-2); flex: none; }
.uploader-prev.ph { display: flex; align-items: center; justify-content: center; background-image: repeating-linear-gradient(-45deg, transparent 0 9px, rgba(99,101,105,.12) 9px 18px); font-size: 11px; color: var(--ppi-gray-10); font-weight: 700; }

.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(12,15,14,.55); display: flex; align-items: flex-start; justify-content: center; padding: 50px 20px; z-index: 50; overflow: auto; }
.modal { background: var(--paper); border-radius: 16px; width: 100%; max-width: 760px; box-shadow: var(--shadow-2); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--font-head); font-weight: 800; font-size: 24px; }
.modal-body { padding: 28px; }
.x-btn { background: none; border: none; cursor: pointer; font-size: 26px; color: var(--ppi-gray-10); line-height: 1; padding: 4px 8px; border-radius: 8px; }
.x-btn:hover { background: var(--paper-2); }

/* ---------- Ciclos / tiempos ---------- */
.cycle-row { display: grid; grid-template-columns: 40px 1fr 130px 120px; align-items: center; gap: 18px; padding: 16px 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.cycle-row.off { opacity: .5; }
.cycle-handle { display: flex; flex-direction: column; gap: 3px; }
.cycle-ord { display: flex; gap: 6px; }
.ord-btn { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 15px; color: var(--ppi-gray-10); }
.ord-btn:hover { border-color: var(--ppi-green); color: var(--ppi-green); }
.cycle-name { font-family: var(--font-head); font-weight: 700; font-size: 19px; }
.cycle-sub { font-size: 13px; color: var(--ppi-gray-10); font-weight: 500; margin-top: 2px; }
.dur-input { display: flex; align-items: center; gap: 8px; }
.dur-input input { width: 78px; }
.dur-input span { font-size: 13px; color: var(--ppi-gray-10); }

/* ---------- Toggle ---------- */
.switch { position: relative; width: 52px; height: 30px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--ppi-gray-7); border-radius: 999px; transition: .2s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--ppi-green); }
.switch input:checked + .track .knob { transform: translateX(22px); }

/* ---------- Layout picker (apariencia) ---------- */
.layout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.layout-opt { border: 3px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; background: #fff; transition: border-color .15s; }
.layout-opt:hover { border-color: var(--ppi-gray-7); }
.layout-opt.sel { border-color: var(--ppi-green); }
.layout-thumb { aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; display: flex; background: var(--paper-2); margin-bottom: 12px; }
.layout-name { font-family: var(--font-head); font-weight: 700; font-size: 18px; }
.layout-desc { font-size: 13px; color: var(--ppi-gray-10); margin-top: 3px; line-height: 1.35; }

/* mini-representaciones */
.lt-side { background: var(--ppi-green); width: 26%; }
.lt-main { background: #fff; flex: 1; }
.lt-bar { background: var(--ink); height: 14%; align-self: flex-end; width: 100%; }
.lt-col { display: flex; flex-direction: column; width: 100%; }
.lt-top { background: #fff; height: 18%; border-bottom: 3px solid var(--ppi-green); }
.lt-fill { flex: 1; background: var(--paper); }
.lt-green { background: var(--ppi-green-900); }
.lt-card { margin: 14%; background: #fff; border-radius: 6px; flex: 1; }

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 22px; box-shadow: var(--shadow-1); }
.stat-num { font-family: var(--font-head); font-weight: 900; font-size: 46px; color: var(--ppi-green); line-height: 1; }
.stat-lbl { font-size: 14px; color: var(--ppi-gray-10); margin-top: 8px; font-weight: 600; }
.preview-wrap { background: #000; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); position: relative; }
.preview-frame { width: 100%; aspect-ratio: 16/9; border: none; display: block; }
.preview-tag { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .08em; padding: 5px 12px; border-radius: 999px; text-transform: uppercase; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 14px 26px; border-radius: 999px; font-weight: 600; font-size: 15px; box-shadow: var(--shadow-2); z-index: 80; display: flex; align-items: center; gap: 10px; animation: toastin .3s ease; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 12px);} to { opacity: 1; transform: translate(-50%, 0);} }
