/* ══════════ LAS TORTILLERIAS · Plataforma de Franquicia v6.1 ══════════
   Marca intocable: logo, nombre, lema "Suaves y Calientitas", paleta
   verde olivo + amarillo MASECA + dorado tortilla. */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #3d5230; --primary-dark: #2a3a20; --primary-light: #eaf0e3;
  --accent: #f9d24a; --accent-dark: #d4a82a; --accent-light: #fef5d3;
  --tortilla: #e8a020;
  --bg: #f7f5ec; --surface: #ffffff; --surface-alt: #faf8f0;
  --border: #e4ddc9; --border-strong: #c9c0a6;
  --text: #26321d; --muted: #5c6c50; --light: #8a9081;
  --success: #2d8659; --success-bg: #e3f5ec;
  --warning: #b8860b; --warning-bg: #fdf6e3;
  --danger: #b54141; --danger-bg: #fde8e8;
  --info: #2c6bb0; --info-bg: #e6f0fa;
  --purple: #7a3eb5; --purple-bg: #f0e8fa;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 3px rgba(38,50,29,.06), 0 1px 2px rgba(38,50,29,.04);
  --shadow-md: 0 10px 28px rgba(38,50,29,.13);
  --ring: 0 0 0 3px rgba(61,82,48,.25);
  --sb-w: 264px;
  --touch: 40px;
}
html, body { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 15px; text-rendering: optimizeLegibility; }
h1,h2,h3 { line-height: 1.25; }
a { color: var(--info); }
code { background: var(--accent-light); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ══════════ BOTONES (sistema unificado) ══════════ */
.btn-primary, .btn-ghost, .btn-danger, .btn-accent {
  font: inherit; font-weight: 700; border-radius: var(--r-sm); padding: 10px 18px;
  min-height: var(--touch); cursor: pointer; border: 1.5px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform .08s ease, box-shadow .15s ease, filter .15s ease;
  box-shadow: var(--shadow);
}
.btn-primary { background: linear-gradient(180deg, #46603a, var(--primary)); color: #fff; }
.btn-accent  { background: linear-gradient(180deg, #fbdc6b, var(--accent)); color: var(--primary-dark); border-color: var(--accent-dark); }
.btn-ghost   { background: var(--surface); color: var(--primary); border-color: var(--border-strong); box-shadow: none; }
.btn-danger  { background: linear-gradient(180deg, #c25252, var(--danger)); color: #fff; }
.btn-primary:hover, .btn-accent:hover, .btn-danger:hover { filter: brightness(1.07); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-ghost:hover { background: var(--primary-light); border-color: var(--primary); }
.btn-primary:active, .btn-accent:active, .btn-ghost:active, .btn-danger:active { transform: scale(.97); box-shadow: var(--shadow); }
button:focus-visible, .chip:focus-visible, input:focus-visible, select:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-block { width: 100%; } .btn-sm { padding: 7px 14px; font-size: 13px; min-height: 34px; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.qty-btn { width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 800; font-size: 15px; line-height: 1; color: var(--primary); transition: background .12s, transform .08s; }
.qty-btn:hover { background: var(--primary-light); } .qty-btn:active { transform: scale(.9); }

/* ══════════ CITAS VERIFICABLES ══════════ */
.cite { display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 800;
  min-width: 18px; height: 18px; padding: 0 5px; margin: 0 2px; border-radius: 6px; vertical-align: super;
  background: var(--info-bg); color: var(--info); border: 1px solid #a8c5e3; cursor: pointer; font-family: Georgia, serif;
  transition: transform .1s, background .12s; line-height: 1; }
.cite:hover { background: var(--info); color: #fff; transform: scale(1.12); }
.cita-box { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-alt); padding: 12px 14px; margin-bottom: 10px; }
.cita-box .cb-ley { font-family: Georgia, serif; font-weight: 700; color: var(--primary-dark); font-size: 15px; }
.cita-box .cb-meta { font-size: 12px; color: var(--muted); margin: 3px 0 6px; }
.verificado { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--success); background: var(--success-bg); border-radius: 20px; padding: 2px 10px; }

/* ══════════ INTERRUPTOR DE IDIOMA ══════════ */
.lang-tg { display: inline-flex; border: 1.5px solid var(--border-strong); border-radius: 20px; overflow: hidden; background: var(--surface); }
.lang-tg button { font: inherit; font-size: 11.5px; font-weight: 800; padding: 5px 11px; border: none; background: transparent; color: var(--muted); cursor: pointer; letter-spacing: .5px; }
.lang-tg button.on { background: var(--primary); color: #fff; }
.lang-tg.compact button { padding: 4px 9px; }

/* ══════════ SITIO PÚBLICO (landing) ══════════ */
#landing { min-height: 100vh; background: linear-gradient(160deg, #fef5d3 0%, #fffdf4 40%, #eaf0e3 100%); }
.pl-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 22px; padding-top: calc(14px + env(safe-area-inset-top)); position: sticky; top: 0; z-index: 50; background: rgba(254,245,211,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.pl-brand { display: flex; align-items: center; gap: 10px; font-family: Georgia, serif; letter-spacing: 1.5px; color: var(--primary-dark); }
.pl-brand img { border-radius: 50%; background: #fdf9ec; box-shadow: 0 0 0 2px rgba(249,210,74,.5); }
.pl-hero { text-align: center; padding: 54px 22px 40px; display: flex; flex-direction: column; align-items: center; }
.pl-logo { width: 190px; height: 190px; border-radius: 50%; background: #fdf9ec; box-shadow: 0 18px 50px rgba(61,82,48,.25), 0 0 0 8px rgba(249,210,74,.35); margin-bottom: 18px; }
.pl-hero h1 { font-family: Georgia, serif; font-size: clamp(30px, 6vw, 46px); letter-spacing: 3px; color: var(--primary-dark); }
.pl-lema { font-family: Georgia, serif; font-style: italic; font-size: 17px; color: var(--accent-dark); margin-top: 4px; }
.pl-sub { max-width: 560px; color: var(--muted); font-size: 15px; margin-top: 12px; }
.pl-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.pl-badges span { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 20px; padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--primary-dark); box-shadow: var(--shadow); }
.pl-sec { max-width: 1080px; margin: 0 auto; padding: 22px; }
.pl-foot { text-align: center; padding: 34px 20px calc(34px + env(safe-area-inset-bottom)); color: var(--light); border-top: 1px solid var(--border); margin-top: 30px; }
.pl-foot img { border-radius: 50%; margin-bottom: 8px; }

/* ══════════ LOGIN ══════════ */
#login-screen { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(150deg,#fef5d3 0%,#faf0c0 45%,#eaf0e3 100%); overflow-y: auto; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-md); padding: 34px 30px; width: 100%; max-width: 430px; text-align: center; }
.login-logo { margin-bottom: 12px; }
.login-logo img { width: 150px; height: 150px; border-radius: 50%; box-shadow: 0 10px 30px rgba(61,82,48,.22), 0 0 0 6px rgba(249,210,74,.35); background: #fdf9ec; }
.login-card h1 { font-family: Georgia, serif; font-size: 22px; color: var(--primary); letter-spacing: .5px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
.login-label { display: block; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 14px 0 6px; }
.user-select { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 64px; background: var(--surface-alt); border: 1.5px solid var(--border-strong); border-radius: var(--r); cursor: pointer; font: inherit; text-align: left; transition: border-color .15s, box-shadow .15s; }
.user-select:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.usr-avatar { font-size: 30px; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; background: var(--accent-light); border-radius: 50%; flex-shrink: 0; }
.usr-meta { flex: 1; min-width: 0; } .usr-meta strong { display: block; font-size: 15px; } .usr-meta small { color: var(--muted); font-size: 12px; }
.chev { color: var(--light); }
.user-menu { display: none; max-height: 300px; overflow-y: auto; border: 1.5px solid var(--border-strong); border-radius: var(--r); margin-top: 6px; text-align: left; background: var(--surface); box-shadow: var(--shadow-md); }
.user-menu.open { display: block; }
.user-menu .grp { padding: 8px 14px 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--light); background: var(--surface-alt); position: sticky; top: 0; }
.user-menu .opt { display: flex; align-items: center; gap: 10px; padding: 9px 14px; min-height: 52px; cursor: pointer; border-top: 1px solid var(--border); }
.user-menu .opt:hover { background: var(--primary-light); }
.user-menu .opt .usr-avatar { width: 38px; height: 38px; font-size: 24px; }
#login-code { width: 100%; padding: 12px 14px; min-height: var(--touch); border: 1.5px solid var(--border-strong); border-radius: var(--r); font-size: 16px; margin-bottom: 8px; background: var(--surface-alt); }
#login-code:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.login-hint { font-size: 12px; color: var(--light); margin-top: 16px; }

/* ══════════ SHELL ══════════ */
#app { display: flex; min-height: 100vh; }
#sidebar { width: var(--sb-w); background: linear-gradient(180deg, #2e4023, var(--primary-dark)); color: #eef2e8; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 200; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 12px; cursor: pointer; }
.sb-logo-img { width: 42px; height: 42px; border-radius: 50%; background: #fdf9ec; box-shadow: 0 2px 8px rgba(0,0,0,.3), 0 0 0 2px rgba(249,210,74,.5); flex-shrink: 0; }
.sb-brand strong { font-family: Georgia, serif; font-size: 14px; letter-spacing: 1px; display: block; color: var(--accent); }
.sb-brand small { font-size: 10px; font-style: italic; color: #a8b59a; }
.sb-workspace { display: flex; gap: 6px; padding: 4px 12px 10px; }
.sb-workspace button { flex: 1; font: inherit; font-size: 12px; font-weight: 700; padding: 9px 4px; min-height: 38px; border-radius: var(--r-sm); border: 1px solid #4a5f3c; background: transparent; color: #c5d1b8; cursor: pointer; transition: background .15s; }
.sb-workspace button:hover { background: rgba(255,255,255,.08); }
.sb-workspace button.active { background: var(--accent); color: var(--primary-dark); border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent-dark); }
.sb-store { margin: 0 12px 8px; padding: 8px 10px; border: 1px dashed #56694a; border-radius: var(--r-sm); font-size: 12px; color: #c5d1b8; }
.sb-store select { width: 100%; margin-top: 4px; font: inherit; font-size: 13px; padding: 6px 8px; min-height: 34px; border-radius: 7px; border: none; background: #3a4c2e; color: #fff; }
#sb-nav { flex: 1; padding: 4px 8px 16px; }
.nav-group { margin-bottom: 2px; }
.nav-group-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; min-height: var(--touch); border: none; background: transparent; color: #dbe4d0; font: inherit; font-size: 14px; font-weight: 600; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.nav-group-head:hover { background: rgba(255,255,255,.07); }
.nav-group-head .ic { width: 22px; text-align: center; }
.nav-group-head .arr { margin-left: auto; font-size: 11px; transition: transform .18s; color: #8fa07e; }
.nav-group.open .nav-group-head .arr { transform: rotate(90deg); }
.nav-sub { display: none; padding-left: 12px; }
.nav-group.open .nav-sub { display: block; }
.nav-item { position: relative; display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; min-height: 38px; border: none; background: transparent; color: #b9c6aa; font: inherit; font-size: 13.5px; border-radius: var(--r-sm); cursor: pointer; text-align: left; transition: background .12s, color .12s; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--accent); color: var(--primary-dark); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3.5px; border-radius: 3px; background: var(--accent); }
.nav-item .ic { width: 20px; text-align: center; }
.nav-item .cnt { margin-left: auto; font-size: 10px; font-weight: 800; background: var(--danger); color: #fff; border-radius: 9px; padding: 1px 6px; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 12px 16px; min-height: 60px; border-top: 1px solid #465939; cursor: pointer; transition: background .12s; }
.sb-user:hover { background: rgba(255,255,255,.06); }
.sb-user .usr-avatar { width: 38px; height: 38px; font-size: 22px; background: #4a5f3c; }
.sb-user strong { display: block; font-size: 13px; color: #fff; } .sb-user small { font-size: 11px; color: #a8b59a; }

#main-wrap { flex: 1; margin-left: var(--sb-w); display: flex; flex-direction: column; min-width: 0; }
#topbar { position: sticky; top: 0; z-index: 150; display: flex; align-items: center; gap: 12px; padding: 10px 20px; padding-top: calc(10px + env(safe-area-inset-top)); background: rgba(247,245,236,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
#hamburger { display: none; font-size: 20px; width: var(--touch); height: var(--touch); border: none; background: none; cursor: pointer; color: var(--primary); border-radius: var(--r-sm); }
#crumb { flex: 1; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#crumb strong { color: var(--text); font-size: 16px; }
.top-actions { display: flex; gap: 6px; }
.icon-btn { position: relative; font-size: 17px; width: var(--touch); height: var(--touch); border-radius: 50%; border: 1px solid var(--border); background: var(--surface); cursor: pointer; box-shadow: var(--shadow); transition: transform .1s, box-shadow .15s; }
.icon-btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
.badge-dot { position: absolute; top: 6px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); display: none; border: 1.5px solid #fff; }
.badge-dot.on { display: block; }
#content { flex: 1; padding: 22px; padding-bottom: calc(22px + env(safe-area-inset-bottom)); max-width: 1280px; width: 100%; margin: 0 auto; animation: fadeUp .22s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#bottom-nav { display: none; }

/* ══════════ COMPONENTES ══════════ */
.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: 23px; color: var(--primary-dark); font-family: Georgia, serif; }
.page-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; max-width: 760px; }
.hero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 18px; background: linear-gradient(120deg, var(--accent-light) 0%, #fffdf4 55%, var(--primary-light) 100%); border: 1px solid var(--border); border-radius: 18px; padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow-md); }
.hero::after { content: ""; position: absolute; right: -46px; top: -46px; width: 190px; height: 190px; border-radius: 50%; background: radial-gradient(circle, rgba(249,210,74,.30), transparent 68%); }
.hero .hero-logo { width: 92px; height: 92px; border-radius: 50%; flex-shrink: 0; background: #fdf9ec; box-shadow: 0 8px 22px rgba(61,82,48,.20), 0 0 0 4px rgba(249,210,74,.4); z-index: 1; }
.hero h2 { font-family: Georgia, serif; font-size: 25px; color: var(--primary-dark); }
.hero p { color: var(--muted); font-size: 13.5px; margin-top: 3px; max-width: 640px; }
.hero .fecha { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.4px; color: var(--accent-dark); }
.hero .lema { display: inline-block; margin-top: 7px; font-family: Georgia, serif; font-style: italic; font-size: 12.5px; color: var(--primary); background: rgba(249,210,74,.28); border: 1px solid var(--accent-dark); border-radius: 20px; padding: 3px 12px; }
@media (max-width: 640px) { .hero { flex-direction: column; text-align: center; padding: 22px 16px; } .hero .hero-logo { width: 104px; height: 104px; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.card h3 { font-size: 15px; margin-bottom: 10px; color: var(--primary-dark); }
.card.tap { cursor: pointer; transition: transform .12s, box-shadow .15s, border-color .12s; }
.card.tap:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.card.tap:active { transform: scale(.98); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); border-radius: 0 3px 3px 0; }
.kpi.k-ok::before { background: var(--success); } .kpi.k-warn::before { background: var(--warning); } .kpi.k-bad::before { background: var(--danger); } .kpi.k-info::before { background: var(--info); }
.kpi .lb { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.kpi .val { font-size: 26px; font-weight: 800; color: var(--primary-dark); margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--light); }
.kpi .sub.up { color: var(--success); } .kpi .sub.down { color: var(--danger); }
.kpi .spark { position: absolute; right: 10px; bottom: 10px; opacity: .9; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.p-ok { background: var(--success-bg); color: var(--success); } .p-warn { background: var(--warning-bg); color: var(--warning); }
.p-bad { background: var(--danger-bg); color: var(--danger); } .p-info { background: var(--info-bg); color: var(--info); }
.p-purple { background: var(--purple-bg); color: var(--purple); } .p-mut { background: var(--surface-alt); color: var(--muted); border: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--surface); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
.tbl th { text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); background: var(--surface-alt); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover, .tbl tr.clickable:hover { background: var(--primary-light); }
.tbl tr.clickable { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #4a6a3a, var(--primary)); border-radius: 6px; transition: width .4s ease; }
.bar.warn > i { background: var(--warning); } .bar.bad > i { background: var(--danger); } .bar.acc > i { background: var(--accent-dark); }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 24px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { font: inherit; font-size: 13.5px; font-weight: 600; padding: 10px 14px; min-height: var(--touch); border: none; background: none; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.searchbar { width: 100%; padding: 10px 14px; min-height: var(--touch); border: 1.5px solid var(--border-strong); border-radius: var(--r); font: inherit; background: var(--surface); margin-bottom: 14px; }
.searchbar:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.fg label { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 4px; }
.fg input, .fg select, .fg textarea { width: 100%; padding: 9px 12px; min-height: var(--touch); border: 1.5px solid var(--border-strong); border-radius: var(--r-sm); font: inherit; background: var(--surface); }
.fg textarea { min-height: 70px; }
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.fg input[readonly] { background: var(--surface-alt); color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; color: var(--light); }
.empty .big { font-size: 44px; margin-bottom: 8px; }
.avatar-lg { font-size: 44px; width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; background: var(--accent-light); border: 2px solid var(--accent-dark); border-radius: 50%; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; min-height: 48px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow strong { display: block; font-size: 14px; }
.list-row .grow small { color: var(--muted); font-size: 12.5px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; font-weight: 600; padding: 6px 13px; min-height: 32px; border-radius: 20px; border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; color: var(--muted); font-family: inherit; transition: background .12s, transform .08s; display: inline-flex; align-items: center; }
.chip:hover { background: var(--primary-light); }
.chip:active { transform: scale(.95); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.callout { border-radius: var(--r); padding: 12px 14px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid; }
.callout.warn { background: var(--warning-bg); border-color: #e8ce8a; color: #6b5006; }
.callout.info { background: var(--info-bg); border-color: #a8c5e3; color: #1d4a7a; }
.callout.ok { background: var(--success-bg); border-color: #a8d8be; color: #1d5e3d; }
.callout.bad { background: var(--danger-bg); border-color: #e5a8a8; color: #7d2b2b; }

/* ══════════ SHEET ══════════ */
#sheet-backdrop { display: none; position: fixed; inset: 0; background: rgba(20,28,14,.45); z-index: 400; }
#sheet { display: none; position: fixed; z-index: 401; background: var(--surface); box-shadow: var(--shadow-md); overflow-y: auto;
  right: 0; top: 0; bottom: 0; width: min(540px, 100%); border-left: 1px solid var(--border); padding: 22px; padding-bottom: calc(22px + env(safe-area-inset-bottom)); animation: sheetIn .2s ease; }
@keyframes sheetIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#sheet.open, #sheet-backdrop.open { display: block; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { font-size: 18px; color: var(--primary-dark); font-family: Georgia, serif; }
.sheet-close { font-size: 20px; border: none; background: var(--surface-alt); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; color: var(--muted); transition: background .12s; }
.sheet-close:hover { background: var(--danger-bg); color: var(--danger); }
#toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(80px); background: var(--primary-dark); color: #fff; padding: 12px 22px; border-radius: 30px; font-size: 14px; font-weight: 600; z-index: 500; opacity: 0; transition: all .25s; box-shadow: var(--shadow-md); max-width: 90vw; text-align: center; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ══════════ POS ══════════ */
.pos-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.pos-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pos-item { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r); padding: 14px 10px; min-height: 118px; cursor: pointer; text-align: center; transition: transform .1s, border-color .1s, box-shadow .15s; user-select: none; -webkit-user-select: none; }
.pos-item:active { transform: scale(.94); }
.pos-item:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.pos-item .em { font-size: 32px; }
.pos-item strong { display: block; font-size: 13px; margin-top: 4px; line-height: 1.2; }
.pos-item small { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.pos-item .tax-tag { display: block; font-size: 9.5px; font-weight: 700; color: var(--light); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.pos-cart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; position: sticky; top: 74px; }
.cart-line { display: flex; align-items: center; gap: 8px; padding: 8px 0; min-height: 44px; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.cart-tot { display: flex; justify-content: space-between; font-size: 13.5px; padding: 3px 0; color: var(--muted); }
.cart-tot.big { font-size: 20px; font-weight: 800; color: var(--primary-dark); border-top: 2px solid var(--primary); margin-top: 6px; padding-top: 8px; }
.pay-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 12px; }
.pay-row button { font: inherit; font-size: 12.5px; font-weight: 700; padding: 10px 4px; min-height: 44px; border-radius: var(--r-sm); border: 1.5px solid var(--border-strong); background: var(--surface-alt); cursor: pointer; transition: background .12s; }
.pay-row button.sel { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ══════════ WIZARD ══════════ */
.wiz-steps { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.wiz-dot { flex-shrink: 0; display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; padding: 8px 13px; min-height: 38px; border-radius: 20px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--muted); cursor: pointer; white-space: nowrap; font-family: inherit; transition: transform .08s; }
.wiz-dot:active { transform: scale(.96); }
.wiz-dot.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.wiz-dot.done { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; min-height: 48px; border-bottom: 1px solid var(--border); cursor: pointer; }
.check-item:last-child { border-bottom: none; }
.check-item input { margin-top: 3px; width: 19px; height: 19px; accent-color: var(--primary); flex-shrink: 0; }
.check-item.done strong { text-decoration: line-through; color: var(--light); }
.check-item strong { font-size: 14px; display: block; }
.check-item small { color: var(--muted); font-size: 12.5px; }

/* ══════════ SEGURIDAD ══════════ */
.cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.cam { border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); background: #1a2013; position: relative; aspect-ratio: 16/10; cursor: pointer; transition: transform .12s, box-shadow .15s; }
.cam:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.cam .feed { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 46px; opacity: .85; }
.cam .scan { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.025) 3px 4px); }
.cam .cam-label { position: absolute; left: 8px; top: 8px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0,0,0,.55); padding: 2px 8px; border-radius: 4px; }
.cam .rec { position: absolute; right: 8px; top: 8px; font-size: 10px; font-weight: 800; color: #fff; background: var(--danger); padding: 2px 7px; border-radius: 4px; display: flex; align-items: center; gap: 4px; }
.cam .rec::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
.cam .cam-time { position: absolute; right: 8px; bottom: 8px; font-size: 10.5px; color: #cfe3bd; font-family: monospace; }
.cam.offline { opacity: .55; } .cam.offline .rec { background: var(--light); } .cam.offline .rec::before { animation: none; }
@keyframes blink { 50% { opacity: .2; } }
.sensor { display: flex; align-items: center; gap: 12px; }
.sensor .gauge { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; background: var(--surface-alt); border: 3px solid var(--success); }
.sensor.warn .gauge { border-color: var(--warning); } .sensor.bad .gauge { border-color: var(--danger); animation: blink 1s infinite; }

/* ══════════ DOC HUB / KANBAN / ESTADOS / TICKET ══════════ */
.doc-card { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); padding: 13px 14px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow); }
.doc-card .dc-icon { font-size: 26px; width: 46px; height: 46px; border-radius: var(--r-sm); background: var(--surface-alt); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; align-items: start; }
.kb-col { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--r); padding: 10px; }
.kb-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px; margin-bottom: 8px; font-size: 13px; box-shadow: var(--shadow); cursor: pointer; transition: transform .1s, border-color .1s; }
.kb-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.state-cell { border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 10px; min-height: 64px; cursor: pointer; background: var(--surface); font-size: 12.5px; transition: transform .1s, border-color .1s, box-shadow .12s; }
.state-cell:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.state-cell:active { transform: scale(.96); }
.state-cell.sel { border-color: var(--primary); background: var(--primary-light); }
.state-cell strong { display: block; font-size: 13.5px; }
.ticket { font-family: "SF Mono", Menlo, monospace; font-size: 12.5px; background: #fffef8; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); padding: 16px; white-space: pre-wrap; line-height: 1.6; }

/* ══════════ RESPONSIVE — 3 modos nativos ══════════ */

/* — iPad / tablet (861–1180px): sidebar compacta, densidad media — */
@media (min-width: 861px) and (max-width: 1180px) {
  :root { --sb-w: 224px; }
  #content { padding: 18px; }
  .pos-layout { grid-template-columns: 1fr 300px; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) and (min-width: 861px) {
  .pos-layout { grid-template-columns: 1fr 290px; }
}
/* — Dedo en vez de mouse: targets 44px, sin hovers de levitación — */
@media (hover: none) and (pointer: coarse) {
  :root { --touch: 44px; }
  .qty-btn { width: 36px; height: 36px; }
  .card.tap:hover, .btn-primary:hover, .cam:hover { transform: none; }
}
/* — Celular (≤860px): navegación inferior, sheet tipo drawer — */
@media (max-width: 860px) {
  :root { --sb-w: 0px; }
  #sidebar { transform: translateX(-100%); transition: transform .22s; width: 286px; box-shadow: var(--shadow-md); }
  #sidebar.open { transform: translateX(0); }
  #main-wrap { margin-left: 0; }
  #hamburger { display: block; }
  #content { padding: 14px; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-cart { position: static; }
  #bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 180; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  #bottom-nav button { font: inherit; border: none; background: none; font-size: 10.5px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; padding: 5px 10px; min-width: 56px; border-radius: var(--r-sm); }
  #bottom-nav button .ic { font-size: 21px; }
  #bottom-nav button.active { color: var(--primary); background: var(--primary-light); }
  #sheet { width: 100%; border-left: none; border-radius: 20px 20px 0 0; top: auto; max-height: 88vh; animation: sheetUp .22s ease; }
  #sheet::before { content: ""; display: block; width: 40px; height: 4.5px; border-radius: 3px; background: var(--border-strong); margin: -6px auto 12px; }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .g4 { grid-template-columns: 1fr 1fr; }
  .hero h2, .page-head h2 { font-size: 20px; }
  .kpi .val { font-size: 22px; }
}
@media print {
  #sidebar, #topbar, #bottom-nav, .no-print { display: none !important; }
  #main-wrap { margin: 0; } body { background: #fff; }
}
