/* ==========================================================================
   Qarta — estilos del panel (restaurante y superadmin)
   ========================================================================== */
:root {
  --ink: #14211d;
  --ink-dim: #5b6a64;
  --paper: #f6f4ee;
  --card: #ffffff;
  --line: #e2dfd4;
  --brand: #0f7b63;
  --brand-dark: #0a5b49;
  --saffron: #f2b01e;
  --danger: #c0392b;
  --radius: 14px;
  --font-display: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.01em; }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 17px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 18px 60px; }
.wrap.narrow { max-width: 460px; }

/* ---------- barra superior ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 0 10px; }
.logo { font-family: var(--font-display); font-weight: 800; font-size: 26px; color: var(--ink); text-decoration: none; letter-spacing: -0.03em; display: inline-flex; align-items: baseline; gap: 2px; }
.logo i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--saffron); transform: rotate(45deg); margin-left: 3px; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--ink-dim); }
.topbar-right a { color: var(--ink-dim); }

.nav { display: flex; gap: 4px; overflow-x: auto; padding: 4px 0 14px; margin-bottom: 8px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; color: var(--ink-dim); text-decoration: none; font-weight: 600; font-size: 15px; }
.nav a:hover { background: rgba(15,123,99,0.08); color: var(--brand-dark); }
.nav a.is-active { background: var(--ink); color: #fff; }

/* ---------- tarjetas y formularios ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 16px 0; }
.card > :last-child { margin-bottom: 0; }
.lead { color: var(--ink-dim); margin: 0 0 16px; }
.hint { color: var(--ink-dim); font-size: 13.5px; margin: 6px 0 0; }
.field-label { display: block; font-weight: 700; font-size: 14px; margin: 16px 0 6px; }
.field-label:first-child { margin-top: 0; }
.text-input, select.text-input, textarea.text-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink); font: inherit; font-size: 16px;
}
.text-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,123,99,0.15); }
textarea.text-input { resize: vertical; min-height: 84px; }
input[type="color"] { width: 54px; height: 42px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 3px; cursor: pointer; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; min-width: 0; }
.check { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); flex-shrink: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 10px; border: 1.5px solid transparent; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none; transition: transform .08s, background .15s; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-danger { background: #fff; color: var(--danger); border-color: #efc9c4; }
.btn-danger:hover { background: #fdf0ee; }
.btn-sm { padding: 7px 12px; font-size: 14px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.alert { padding: 12px 16px; border-radius: 10px; margin: 14px 0; font-size: 15px; }
.alert-ok { background: #e3f4ee; color: #0a5b49; }
.alert-error { background: #fbe9e6; color: #8c2a1e; }
.alert-info { background: #fff4d6; color: #7a5a00; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: #eee; color: #555; }
.badge-ok { background: #e3f4ee; color: #0a5b49; }
.badge-warn { background: #fff0cc; color: #8a6200; }
.badge-off { background: #f3dcd8; color: #8c2a1e; }

table.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; color: var(--ink-dim); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0; }
.stat-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat-box .num { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1; }
.stat-box .label { color: var(--ink-dim); font-size: 13.5px; margin-top: 6px; }

/* ---------- editor de carta ---------- */
.cat-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; overflow: hidden; }
.cat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #fbfaf6; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cat-head h3 { margin: 0; flex: 1 1 140px; }
.cat-head form { display: inline; }
.prod-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.prod-row:last-child { border-bottom: none; }
.prod-thumb { width: 54px; height: 54px; border-radius: 10px; background: #efece3 center/cover no-repeat; flex-shrink: 0; }
.prod-info { flex: 1; min-width: 0; }
.prod-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-info span { color: var(--ink-dim); font-size: 14px; }
.prod-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.prod-row.is-off .prod-info strong { text-decoration: line-through; color: var(--ink-dim); }
.icon-btn { background: #fff; border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink); }
.icon-btn:hover { border-color: var(--ink); }

.group-box { border: 1.5px solid var(--line); border-radius: 12px; padding: 16px; margin: 14px 0; background: #fcfbf8; }
.option-row { display: flex; gap: 8px; margin: 8px 0; align-items: center; }
.option-row .text-input { flex: 1 1 auto; }
.option-row .price { flex: 0 0 130px; }
.option-row .rm, .group-box .rm-group { flex: 0 0 auto; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.photo-prev { width: 120px; height: 120px; border-radius: 12px; background: #efece3 center/cover no-repeat; border: 1px solid var(--line); }
.cover-prev { width: 100%; aspect-ratio: 16/6; max-width: 480px; border-radius: 12px; background: #efece3 center/cover no-repeat; border: 1px solid var(--line); }

.qr-box { display: inline-block; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.qr-item { text-align: center; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; break-inside: avoid; }
.qr-item .qr-target { display: flex; justify-content: center; margin-bottom: 8px; }
.qr-item strong { font-family: var(--font-display); font-size: 20px; display: block; }

.hero-copy { margin: 30px 0 6px; }
.hero-copy h1 { font-size: 34px; }

@media (max-width: 560px) {
  h1 { font-size: 24px; }
  .card { padding: 16px; }
  .prod-row { flex-wrap: wrap; }
  .prod-actions { width: 100%; justify-content: flex-start; }
  .option-row .price { flex-basis: 96px; }
}
@media print {
  .topbar, .nav, .no-print, .btn-group { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .qr-item { border: 1px dashed #bbb; }
}
/* controles compactos dentro de tablas (superadmin) */
.table td .row{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.table td .row>*{flex:0 0 auto}
.table td .text-input{padding:7px 10px;width:auto;margin:0}
.table td form{margin:0}

/* ojo de contraseña */
.pw-wrap{position:relative}
.pw-wrap .text-input{padding-right:48px}
.pw-eye{position:absolute;right:6px;top:50%;transform:translateY(-50%);margin-top:3px;background:none;border:none;color:var(--ink-dim);cursor:pointer;padding:8px;border-radius:8px;line-height:0}
.pw-eye:hover,.pw-eye[aria-pressed=true]{color:var(--ink)}
.pw-eye:focus-visible{outline:2px solid var(--brand);outline-offset:1px}

/* horario semanal */
.hours-row{display:flex;align-items:center;gap:8px;margin:6px 0}
.hours-row .check{flex:1 1 130px;margin:0}
.hours-day{font-weight:500}
.hours-row .text-input{flex:0 0 112px;width:112px;margin:0;padding:8px 10px}
@media (max-width:420px){.hours-row .text-input{flex-basis:96px;width:96px}}

.tag-pick{display:flex;flex-wrap:wrap;gap:4px 18px}

/* más vendidos */
.topbar-row{margin:12px 0}
.top-name{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}
.top-name span{color:var(--ink-dim);font-size:14px}
.top-bar{height:8px;background:#ece9df;border-radius:99px;margin-top:6px;overflow:hidden}
.top-bar i{display:block;height:100%;background:var(--brand);border-radius:99px}
@media (max-width:520px){
  .hours-row{flex-wrap:wrap}
  .hours-row .check{flex:1 1 100%}
  .hours-row .text-input{flex:1 1 120px;width:auto}
  .hours-row span:not(.hours-day){flex:0 0 auto}
}