:root {
  --bg: #f4f3f1; --panel: #ffffff; --panel-2: #f8f7f5; --ink: #1d1b19; --ink-2: #5f5a55; --ink-3: #8f8983;
  --line: #e6e2dd; --brand: #ff7a1a; --brand-ink: #1c0f05; --brand-soft: #fff1e6;
  --ok: #1f8a4c; --danger: #c93a2f; --danger-soft: #fdecea; --chart: #e8650a;
  --r: 14px; --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 6px 24px rgb(0 0 0 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #131211; --panel: #1c1a19; --panel-2: #232120; --ink: #f2efeb; --ink-2: #b4ada6; --ink-3: #847d76;
    --line: #2f2c2a; --brand-soft: #3a2414; --danger-soft: #3a1a17; --chart: #ff8a3a;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 24px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: 'Readex Pro', system-ui, sans-serif; font-size: 14px; line-height: 1.5; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---------- botones e inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 500; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; display: inline-grid; place-items: center; font-size: 15px; }
.icon-btn:hover { border-color: var(--ink-3); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.link { background: none; border: 0; color: var(--ink-2); cursor: pointer; text-decoration: underline; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=tel], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
label.f { display: grid; gap: 6px; }
label.f > span { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--ink-3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* switch */
.sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; }
.sw input { display: none; }
.sw i { width: 40px; height: 23px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.sw i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s; }
.sw input:checked + i { background: var(--ok); }
.sw input:checked + i::after { transform: translateX(17px); }
[dir=rtl] .sw input:checked + i::after { transform: translateX(-17px); }
.sw span small { display: block; color: var(--ink-3); font-size: 12px; }

/* segmentado */
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .1); font-weight: 600; }

/* rango */
.range { display: grid; gap: 4px; }
.range div { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); }
.range input { width: 100%; accent-color: var(--brand); }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px 26px; display: grid; gap: 14px; text-align: center; box-shadow: var(--shadow); }
.login-card h1 { font-size: 21px; }
.login-card p { margin: 0; color: var(--ink-2); }
.login-card .btn { height: 44px; }
.logo-mark { width: 52px; height: 52px; border-radius: 15px; background: var(--brand); color: var(--brand-ink); font-weight: 800; display: grid; place-items: center; margin: 0 auto 4px; font-size: 17px; letter-spacing: -.02em; }
.logo-mark.sm { width: 38px; height: 38px; border-radius: 11px; font-size: 13px; margin: 0; }
.err { color: var(--danger); min-height: 1em; }

/* ---------- estructura ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100dvh; }
.side { background: var(--panel); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding: 16px 12px; }
.side-head { display: flex; gap: 10px; align-items: center; padding: 4px 6px 18px; }
.side-head strong { display: block; font-size: 15px; line-height: 1.2; }
.side-head small { color: var(--ink-3); font-size: 12px; }
nav { display: grid; gap: 2px; overflow-y: auto; }
nav button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 10px; cursor: pointer; color: var(--ink-2); text-align: start; font-weight: 500; }
nav button:hover { background: var(--panel-2); color: var(--ink); }
nav button.on { background: var(--brand-soft); color: var(--ink); font-weight: 600; }
nav button .ni { width: 22px; text-align: center; font-size: 16px; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.main { min-width: 0; }
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); min-height: 64px; }
.bar h2 { font-size: 19px; }
.bar-actions { margin-inline-start: auto; display: flex; gap: 8px; }
.view { padding: 24px 28px 60px; max-width: 1280px; }
.only-mobile { display: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h3 { font-size: 15px; margin-bottom: 4px; }
.card > .hint:first-of-type { margin: 0 0 14px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }

.notice { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); margin-bottom: 16px; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.tile small { color: var(--ink-2); font-size: 12.5px; display: block; }
.tile b { display: block; font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--ink-3); }

/* ---------- lista de platos ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-width: 200px; }
.dlist { display: grid; gap: 8px; }
.drow { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px 10px 10px; }
[dir=rtl] .drow { padding: 10px 10px 10px 14px; }
.drow.off { opacity: .55; }
.thumb { width: 64px; height: 64px; border-radius: 11px; background: var(--panel-2); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb img.cover { object-fit: cover; }
.drow h4 { font-size: 14.5px; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 3px; color: var(--ink-2); font-size: 12.5px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-size: 11.5px; font-weight: 500; }
.pill.b3d { background: var(--brand-soft); border-color: transparent; color: var(--ink); }
.pill.hd { background: #1d1b19; color: #fff; border-color: transparent; }
.acts { display: flex; gap: 6px; align-items: center; }
.star { color: var(--ink-3); }
.star.on { color: #e3a008; }
.empty { text-align: center; padding: 40px; color: var(--ink-3); border: 1px dashed var(--line); border-radius: var(--r); }

/* ---------- cajón (editor) ---------- */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-bg { position: absolute; inset: 0; background: rgb(0 0 0 / .35); }
.drawer-panel { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(720px, 100%); background: var(--bg); display: flex; flex-direction: column; box-shadow: -10px 0 40px rgb(0 0 0 / .15); animation: slide .25s ease-out; }
@keyframes slide { from { transform: translateX(-30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
.drawer-head h3 { font-size: 17px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 30px; display: grid; gap: 16px; align-content: start; }
.drawer-foot { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--panel); }
.drawer .card { padding: 18px; }
.drawer .card + .card { margin: 0; }

.ltabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.ltabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.ltabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.ltabs button.miss::after { content: '•'; color: var(--danger); margin-inline-start: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 6px 11px; cursor: pointer; font-size: 13px; }
.chips button.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }

.mv-box { position: relative; height: 300px; border-radius: 12px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #3a302a, #15110e); }
.mv-box model-viewer { width: 100%; height: 100%; direction: ltr; --poster-color: transparent; }
.mv-box .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #a8998c; text-align: center; padding: 20px; }
.files { display: grid; gap: 8px; margin-top: 12px; }
.file { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.file b { font-weight: 600; }
.file code { color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; flex: 1; min-width: 0; }
.upl { position: relative; overflow: hidden; }
.upl input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.img-pick { display: flex; gap: 12px; align-items: center; }
.img-pick .thumb { width: 72px; height: 72px; }

/* ---------- apariencia ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.preview { position: sticky; top: 84px; }
.phone { width: 360px; height: 740px; max-height: calc(100dvh - 130px); border-radius: 44px; padding: 10px; background: #0d0d0d; box-shadow: 0 20px 60px rgb(0 0 0 / .25), inset 0 0 0 2px #333; margin: 0 auto; }
.phone iframe { width: 100%; height: 100%; border: 0; border-radius: 35px; background: #000; }
.preview .row { justify-content: center; margin-top: 10px; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.preset { border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; background: var(--panel); text-align: start; }
.preset.on { border-color: var(--brand); }
.preset .sw-row { display: flex; height: 34px; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.preset .sw-row i { flex: 1; }
.preset b { font-size: 13px; }
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.color { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.color input[type=color] { width: 34px; height: 34px; border: 0; padding: 0; background: none; border-radius: 8px; cursor: pointer; flex: none; }
.color input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.color input[type=color]::-webkit-color-swatch { border: 1px solid var(--line); border-radius: 8px; }
.color span { font-size: 12.5px; line-height: 1.2; }
.color code { display: block; font-size: 11px; color: var(--ink-3); direction: ltr; text-align: start; }
.savebar { position: sticky; bottom: 0; margin-top: 16px; display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }

/* ---------- QR ---------- */
.qr-out { display: grid; grid-template-columns: 240px 1fr; gap: 22px; align-items: start; }
.qr-img { width: 240px; height: 240px; border-radius: 16px; background: #fff; padding: 12px; border: 1px solid var(--line); }
.qr-img img { width: 100%; height: 100%; }
.url-box { display: flex; gap: 8px; }
.url-box input { direction: ltr; text-align: left; }

/* ---------- gráfico ---------- */
.chart { position: relative; height: 220px; display: flex; align-items: flex-end; gap: 2px; padding: 0 0 22px; border-bottom: 1px solid var(--line); direction: ltr; }
.chart .col { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; cursor: default; }
.chart .col i { display: block; width: 100%; max-width: 26px; margin: 0 auto; background: var(--chart); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart .col:hover i { filter: brightness(1.12); }
.chart .col:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.chart .col small { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.chart .gl { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); pointer-events: none; }
.chart .gl span { position: absolute; top: -9px; left: 0; font-size: 10.5px; color: var(--ink-3); background: var(--panel); padding-right: 4px; }
.chart-tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--panel); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow); white-space: nowrap; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 8px; text-align: start; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--ink-2); font-weight: 500; }
td.n, th.n { text-align: end; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 70; background: var(--ink); color: var(--panel); padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; animation: pop .2s; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes pop { from { transform: translate(-50%, 10px); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .preview { position: static; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow); }
  [dir=rtl] .side { transform: translateX(100%); }
  .side.open { transform: none !important; }
  .only-mobile { display: inline-grid; }
  .bar { padding: 12px 16px; }
  .view { padding: 16px 16px 60px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .drow { grid-template-columns: 52px 1fr; }
  .drow .thumb { width: 52px; height: 52px; }
  .drow .acts { grid-column: 1 / -1; justify-content: flex-end; }
  .qr-out { grid-template-columns: 1fr; }
  .phone { width: 100%; max-width: 360px; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1; }
}

/* ---------- SaaS additions ---------- */
.login-card .logo-mark { margin: 0 auto; text-decoration: none; }
.login-card a.btn.ghost { border-style: dashed; }
.layouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.lay { display: grid; justify-items: center; gap: 4px; padding: 12px 8px 10px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--panel-2); cursor: pointer; text-align: center; color: var(--ink-2); }
.lay:hover { border-color: var(--ink-3); }
.lay.on { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); }
.lay-svg { width: 44px; height: 64px; color: currentColor; }
.lay.on .lay-svg { color: var(--brand); }
.lay b { font-size: 13px; color: var(--ink); }
.lay small { font-size: 11px; color: var(--ink-3); line-height: 1.3; }
.welcome { display: flex; gap: 18px; align-items: center; justify-content: space-between; background: linear-gradient(135deg, var(--brand-soft), var(--panel)); border-color: var(--brand); }
.welcome h3 { font-size: 20px; }
.welcome p { color: var(--ink-2); margin: 8px 0 0; line-height: 1.8; }
.welcome-qr { width: 132px; flex: none; background: #fff; border-radius: 14px; padding: 8px; }
.welcome-qr img { width: 100%; display: block; }
.ios-stat { margin-top: 10px; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ios-stat.ok { color: #1f8f4e; }
.ios-stat.warn { color: var(--ink-2); }
.ios-stat.busy { color: var(--brand); }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.slug-box { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.slug-box code { padding: 0 4px 0 12px; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.slug-box input { border: 0 !important; box-shadow: none !important; padding-inline-start: 0; }
.err { color: #d23b2f; }
.owner-table { width: 100%; }
.owner-table td { vertical-align: top; }
.owner-table td a { font-size: 12px; color: var(--brand); }
.owner-table tr.off { opacity: .55; }
.owner-table .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 760px) {
  .layouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .welcome { flex-direction: column; align-items: stretch; }
  .welcome-qr { width: 120px; }
  .owner-table thead { display: none; }
  .owner-table tr { display: grid; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .owner-table td { border: 0 !important; padding: 2px 0 !important; }
  .owner-table .acts { justify-content: flex-start; }
}
