/* ── Empanadón · Panel de administración ─────────────────────────────── */
:root {
  --bg: #F5F1E8;
  --surface: #FFFFFF;
  --ink: #2C1D0E;
  --ink2: #6B5741;
  --muted: #94826A;
  --line: #E7DCC8;
  --masa: #E9A319;
  --aji: #D1362B;
  --aji-dark: #A8271E;
  --ok: #2E7D32;
  --warn: #C4360E;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(44, 29, 14, .1);
  --fd: 'Baloo 2', system-ui, sans-serif;
  --fb: 'Inter', system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: var(--fb); background: var(--bg); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--fd); font-weight: 700; line-height: 1.15; }
button, input, select { font-family: inherit; font-size: 1rem; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.2rem; background: var(--ink); color: #F6E6CE; position: sticky; top: 0; z-index: 30; }
.brand { font-family: var(--fd); font-weight: 800; font-size: 1.25rem; }
.brand em { font-style: normal; font-weight: 500; color: var(--masa); font-size: .9rem; }
.top-actions { display: flex; gap: .5rem; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font-family: var(--fd); font-weight: 600; padding: .6rem 1.1rem; border-radius: 10px; border: 2px solid transparent; cursor: pointer; transition: transform .12s, background .2s, border-color .2s, color .2s; }
.btn:active { transform: scale(.96); }
.btn-sm { padding: .4rem .8rem; font-size: .88rem; }
.btn-primary { background: var(--aji); color: #fff; }
.btn-primary:hover { background: var(--aji-dark); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.25); color: inherit; }
.btn-ghost:hover { border-color: currentColor; }
.wrap .btn-ghost { border-color: var(--line); color: var(--ink); }
.wrap .btn-ghost:hover { border-color: var(--ink); }
.btn-mini { padding: .3rem .55rem; font-size: .8rem; border-radius: 8px; background: var(--bg); border: 1.5px solid var(--line); cursor: pointer; }
.btn-mini:hover { border-color: var(--aji); color: var(--aji); }
.btn-del:hover { border-color: var(--warn); color: var(--warn); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; padding: 1rem 1.2rem 0; max-width: 1080px; margin: 0 auto; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat b { font-family: var(--fd); font-size: 1.6rem; display: block; line-height: 1.1; }
.stat span { font-size: .82rem; color: var(--muted); }
.stat.alert b { color: var(--warn); }

/* Tabs */
.tabs { display: flex; gap: .3rem; padding: 1rem 1.2rem .2rem; max-width: 1080px; margin: 0 auto; overflow-x: auto; }
.tab { flex-shrink: 0; background: none; border: none; font-family: var(--fd); font-weight: 600; color: var(--muted); padding: .6rem .9rem; border-radius: 10px 10px 0 0; cursor: pointer; }
.tab.is-active { color: var(--aji); background: var(--surface); border: 1px solid var(--line); border-bottom-color: var(--surface); }

/* Wrap / panels */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.2rem 4rem; }
.panel { display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 1.4rem; }
.panel.is-active { display: block; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.panel-head h2 { font-size: 1.35rem; }
.hint { color: var(--muted); font-size: .86rem; margin-top: 1rem; }
.hint b { color: var(--ink2); }

/* Tabla */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; min-width: 620px; }
.tbl th, .tbl td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--line); font-size: .92rem; }
.tbl th { font-family: var(--fd); font-size: .78rem; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr:hover td { background: #FCF8EF; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: .12rem .5rem; border-radius: 50px; }
.pill.low { background: #FBE3DC; color: var(--warn); }
.pill.ok { background: #E4F1E4; color: var(--ok); }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }

/* Recetas */
.recetas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.receta { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.receta-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; margin-bottom: .3rem; }
.receta-head h3 { font-size: 1.2rem; }
.receta-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin: .5rem 0 .8rem; }
.receta-meta .m b { font-family: var(--fd); font-size: 1.1rem; display: block; }
.receta-meta .m span { font-size: .75rem; color: var(--muted); }
.receta-meta .cost b { color: var(--aji-dark); }
.receta-meta .can b { color: var(--ok); }
.ing-list { list-style: none; display: flex; flex-direction: column; gap: .2rem; border-top: 1px dashed var(--line); padding-top: .7rem; }
.ing-list li { display: flex; justify-content: space-between; font-size: .86rem; color: var(--ink2); }
.ing-list li span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); }
.ing-missing { color: var(--warn) !important; font-weight: 600; }

/* Producir */
.prod-form { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field span { font-size: .8rem; font-weight: 600; color: var(--ink2); }
.field select, .field input { padding: .6rem .7rem; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); outline: none; }
.field select:focus, .field input:focus { border-color: var(--masa); }
.field-sm input { width: 100px; }
.prod-result { margin-top: 1rem; }
.prod-ok { background: #E4F1E4; border: 1px solid #Bfe0bf; color: #1c5c20; border-radius: var(--radius); padding: 1rem 1.2rem; }
.prod-bad { background: #FBE3DC; border: 1px solid #f0c0b4; color: var(--warn); border-radius: var(--radius); padding: 1rem 1.2rem; }
.prod-tbl { width: 100%; border-collapse: collapse; margin-top: .7rem; }
.prod-tbl td { padding: .35rem .5rem; font-size: .86rem; border-bottom: 1px solid rgba(0,0,0,.06); }
.prod-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Ajustes */
.card-set { display: flex; flex-direction: column; gap: .8rem; }
.set-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; flex-wrap: wrap; }
.set-item p { color: var(--muted); font-size: .86rem; margin-top: .2rem; }
.set-item.danger { border-color: #f0c0b4; background: #FDF3F0; }
.set-btns { display: flex; gap: .5rem; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(20,12,4,.5); display: grid; place-items: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-card { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 1.2rem; }
.modal-x { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); }
.modal-body { padding: 1.3rem; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.3rem; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form-grid .full { grid-column: 1 / -1; }
.modal label { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; font-weight: 600; color: var(--ink2); }
.modal input, .modal select { padding: .6rem .7rem; border: 1.5px solid var(--line); border-radius: 10px; outline: none; font-weight: 400; color: var(--ink); }
.modal input:focus, .modal select:focus { border-color: var(--masa); }
.ing-rows { display: flex; flex-direction: column; gap: .5rem; }
.ing-row { display: grid; grid-template-columns: 1fr 90px 34px; gap: .5rem; align-items: center; }
.ing-row select, .ing-row input { padding: .5rem .6rem; border: 1.5px solid var(--line); border-radius: 8px; }
.ing-row button { background: var(--bg); border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer; height: 100%; }
.add-row { margin-top: .5rem; background: none; border: 1.5px dashed var(--line); border-radius: 8px; padding: .5rem; cursor: pointer; color: var(--ink2); font-weight: 600; width: 100%; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: .7rem 1.2rem; border-radius: 50px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 80; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .recetas { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
