[hidden] { display: none !important; }
:root {
  --primary: #d62828;
  --accent: #e9a23b;
  --bg: #f5f3ef;
  --panel: #ffffff;
  --line: #e4e0d8;
  --text: #1d1b18;
  --muted: #6f6a62;
  --ok: #1f8f3a;
  --warn: #b26b00;
  --side: #121214;
  --radius: 12px;
  font-family: 'Outfit', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: inherit; }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.15; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--primary); min-height: 1.2em; margin: .3rem 0; font-weight: 600; }

.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: .55rem 1rem; border-radius: 10px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; }
.btn:hover { border-color: #c9c3b8; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--primary); }
.btn.sm { padding: .3rem .6rem; font-size: .85rem; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-align: left; text-decoration: underline; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: #121214; padding: 16px; }
.login-card { background: var(--panel); border-radius: 18px; padding: 2rem; width: min(380px, 100%); display: flex; flex-direction: column; gap: .8rem; text-align: center; }
.login-card img { margin: 0 auto; border-radius: 50%; }
.login-card label { text-align: left; display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }

input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: .55rem .7rem; background: #fff; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { resize: vertical; }

/* Layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: #eee; display: flex; flex-direction: column; padding: 1rem; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; gap: .6rem; align-items: center; margin-bottom: 1.5rem; }
.side-brand img { border-radius: 50%; }
.side-brand div { display: flex; flex-direction: column; line-height: 1.1; }
.side-brand small { color: var(--accent); }
#side-nav { display: flex; flex-direction: column; gap: .2rem; }
#side-nav a { color: #cfcac2; text-decoration: none; padding: .6rem .7rem; border-radius: 9px; display: flex; align-items: center; gap: .3rem; }
#side-nav a:hover { background: #222226; }
#side-nav a.active { background: var(--primary); color: #fff; }
.pill { background: var(--accent); color: #1a1206; border-radius: 999px; font-size: .75rem; padding: 0 .5rem; margin-left: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; font-size: .9rem; }
.side-foot a { color: var(--accent); }
.content { padding: 1.8rem; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head h1 { margin: 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1rem; }
.panel h2 { font-size: 1.15rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.stat b { display: block; font-size: 1.8rem; }
.stat span { color: var(--muted); font-size: .9rem; }

/* Formularios */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.2rem; }
.form-grid .full { grid-column: 1 / -1; }
.f { display: flex; flex-direction: column; gap: .3rem; }
.f > span { font-weight: 600; font-size: .88rem; }
.f small { color: var(--muted); }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.img-field { display: flex; gap: .8rem; align-items: center; }
.img-field img { width: 84px; height: 64px; object-fit: cover; border-radius: 8px; background: #eee; border: 1px solid var(--line); }
.img-field .img-actions { display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 0; }
.actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }

/* Tablas de datos */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.thumb { width: 48px; height: 40px; border-radius: 6px; object-fit: cover; background: #eee; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: #eee; }
.tag.off { background: #fde2e2; color: var(--primary); }
.tag.on { background: #dff3e4; color: var(--ok); }
.tag.star { background: #fff1d6; color: var(--warn); }

/* Carta */
.carta { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; align-items: start; }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list li { display: flex; align-items: center; gap: .4rem; padding: .5rem; border-radius: 9px; cursor: pointer; }
.cat-list li:hover { background: #f4f1ec; }
.cat-list li.active { background: #fff1d6; font-weight: 700; }
.cat-list li .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-list li .count { color: var(--muted); font-size: .8rem; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: .2rem .35rem; border-radius: 6px; color: var(--muted); font-size: .95rem; }
.icon-btn:hover { background: #ebe6de; color: var(--text); }
.toggle { position: relative; width: 40px; height: 22px; display: inline-block; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: #ccc; border-radius: 999px; transition: .15s; cursor: pointer; }
.toggle span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .15s; }
.toggle input:checked + span { background: var(--ok); }
.toggle input:checked + span::after { transform: translateX(18px); }
.search { max-width: 260px; }

/* Grupos de opciones */
.groups { display: flex; flex-direction: column; gap: .8rem; }
.group { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; background: #faf8f5; }
.group-head { display: grid; grid-template-columns: 1fr 80px 80px auto; gap: .5rem; align-items: end; }
.opt-row { display: grid; grid-template-columns: 1fr 120px auto; gap: .5rem; margin-top: .4rem; }

/* Pedidos */
.orders { display: grid; gap: .8rem; }
.order { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.order[data-status=nuevo] { border-left-color: var(--primary); }
.order[data-status=pagado] { border-left-color: #2f6fd6; }
.order[data-status=preparando] { border-left-color: var(--accent); }
.order[data-status=listo] { border-left-color: var(--ok); }
.order[data-status=entregado] { opacity: .75; }
.order[data-status=cancelado] { opacity: .55; }
.order-head { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.order-head h3 { margin: 0; }
.order ul { margin: .6rem 0; padding-left: 1.2rem; }
.order li small { color: var(--muted); }
.order-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; color: var(--muted); font-size: .92rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; }

/* Diálogo */
.dlg { border: 0; border-radius: 16px; padding: 0; width: min(760px, 100% - 24px); max-height: 92vh; }
.dlg::backdrop { background: rgba(0, 0, 0, .5); }
.dlg > div { padding: 1.4rem; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 200%); visibility: hidden; background: #1d1b18; color: #fff; padding: .7rem 1.2rem; border-radius: 999px; font-weight: 600; z-index: 99; transition: transform .2s; }
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.err { background: var(--primary); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  #side-nav { flex-direction: row; overflow-x: auto; }
  #side-nav a { white-space: nowrap; }
  .side-foot { flex-direction: row; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
  .content { padding: 1rem; }
  .carta { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .group-head { grid-template-columns: 1fr 1fr; }
}
