/* ============================================================
   SILVIA · APP SHELL — navegación unificada (app principal + POS)
   Drawer izquierdo: overlay en mobile / sidebar persistente en desktop.
   Tokens en tokens.css (cargar antes que esta hoja).
   ============================================================ */

/* ── Header ─────────────────────────────────────────────────────────────── */
.hdr {
  background: var(--green);
  border-radius: 0 0 22px 22px;
  padding: 16px clamp(18px, 3.5vw, 26px) 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: #fff; position: relative; flex-shrink: 0; overflow-x: clip;
}
.hdr-cluster { display: flex; align-items: center; gap: 11px; min-width: 0; }
.hdr-cluster.right { gap: 10px; }
.hdr-icon {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: #fff; display: grid; place-items: center; transition: background .15s, transform .05s;
  text-decoration: none;
}
.hdr-icon:hover { background: rgba(255,255,255,.16); }
.hdr-icon:active { transform: scale(.95); }
.hdr-word {
  font-style: italic; font-weight: 700; font-size: 20px; color: #fff;
  letter-spacing: .01em; margin-left: 1px; text-decoration: none;
}
.hdr-mono {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  width: 46px; height: 46px; border-radius: 50%; border: 1.4px solid var(--gold);
  display: grid; place-items: center; color: var(--gold);
}
.hdr-mono.inline { position: static; transform: none; width: 40px; height: 40px; flex-shrink: 0; }
.hdr-mono span { font-style: italic; font-weight: 700; font-size: 20px; line-height: 1; }
.hdr-spacer { flex: 1; }

/* cart pill (POS) */
.cartpill {
  display: flex; align-items: center; gap: 11px;
  border: 1.4px solid var(--gold); border-radius: 11px;
  padding: 7px 14px 7px 11px; background: transparent; position: relative;
  text-decoration: none;
}
.cartpill .ic { position: relative; color: #fff; }
.cartpill .badge {
  position: absolute; top: -9px; right: -9px; min-width: 19px; height: 19px; padding: 0 5px;
  background: var(--gold); color: var(--green); border-radius: 999px;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.cartpill .amt { text-align: right; line-height: 1.15; }
.cartpill .amt b { display: block; font-size: 15px; font-weight: 700; color: #fff; }
.cartpill .amt small { font-size: 11px; color: #bcae8d; font-weight: 400; }

/* ── Drawer (base = overlay mobile) ─────────────────────────────────────── */
.drawer-root { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.drawer-root.open { pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(22,33,28,.5); opacity: 0; transition: opacity .25s; }
.drawer-root.open .drawer-backdrop { opacity: 1; }
.drawer {
  position: absolute; top: 0; left: 0; bottom: 0; width: min(84%, 330px);
  background: var(--bg); box-shadow: 0 0 50px rgba(0,0,0,.3);
  display: flex; flex-direction: column; overflow-y: auto;
  transform: translateX(-100%); transition: transform .28s cubic-bezier(.3,.85,.3,1);
}
.drawer-root.open .drawer { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; background: var(--green); color: #fff; }
.drawer-head .hdr-mono.inline { border-color: rgba(255,255,255,.35); filter: grayscale(1); }
.dh-title { font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.dh-sub { font-size: 12px; color: #bcae8d; }
.drawer-x { margin-left: auto; background: rgba(255,255,255,.1); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.drawer-x:hover { background: rgba(255,255,255,.18); }
.drawer-client { display: flex; align-items: center; gap: 12px; padding: 16px 20px 12px; }
.dc-av { width: 44px; height: 44px; border-radius: 50%; background: var(--green); color: var(--gold); display: grid; place-items: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.dc-main { min-width: 0; }
.dc-k { font-size: 12px; color: var(--muted); }
.dc-v { font-size: 15px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-v.anon { color: var(--muted); font-style: italic; }
.drawer-client-actions { display: flex; gap: 8px; padding: 0 20px 14px; border-bottom: 1px solid var(--line-2); }
.dca-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; background: var(--cream-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; font-size: 12.5px; font-weight: 600; color: var(--green); text-decoration: none; cursor: pointer; font-family: inherit; }
.dca-btn:hover { background: var(--green-soft); }
.dca-btn:active { transform: scale(.97); }
.drawer-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); padding: 16px 20px 7px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; background: none; border: 0; padding: 13px 20px; color: var(--ink); font-size: 15px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; font-family: inherit; position: relative; transition: background .12s; }
.nav-item:hover { background: var(--cream-2); }
.nav-item .ni-ic { color: var(--green-2); display: grid; place-items: center; flex-shrink: 0; }
.nav-item .ni-label { flex: 1; }
.nav-item .ni-badge { background: var(--gold); color: var(--green); min-width: 21px; height: 21px; border-radius: 999px; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.nav-item .ni-chev { color: var(--muted-2); flex-shrink: 0; }
.nav-item.danger, .nav-item.danger .ni-ic { color: var(--danger); }
/* estado activo (página actual) */
.nav-item.active { background: var(--green-soft); color: var(--green); font-weight: 600; }
.nav-item.active .ni-ic { color: var(--green); }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.drawer-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }
.drawer-foot .nav-item { padding: 10px 0; }

/* toggle segmentado (preferencias) */
.drawer-toggle { padding: 4px 20px 14px; }
.drawer-toggle .dt-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.seg { display: flex; background: var(--cream); border: 1px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; }
.seg-btn { flex: 1; border: 0; background: none; padding: 9px 8px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; font-family: inherit; transition: background .12s, color .12s; }
.seg-btn.on { background: var(--bg); color: var(--green); box-shadow: 0 1px 2px rgba(22,61,48,.08); }
.seg-btn:active { transform: scale(.97); }

/* foco visible para teclado (a11y) */
.nav-item:focus-visible, .hdr-icon:focus-visible, .drawer-x:focus-visible, .dca-btn:focus-visible {
  outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 8px;
}

/* ── Toast compartido (app + POS) → window.showToast() en shell.js ───────── */
.pos-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--green); color: #fff; padding: 13px 22px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 8px 30px rgba(0,0,0,.25); z-index: 9999; display: flex; align-items: center; gap: 10px; animation: toastIn .2s ease; }
.pos-toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── Desktop ≥1024px: sidebar persistente ───────────────────────────────── */
@media (min-width: 1024px) {
  .drawer-root { width: var(--sidebar-w); inset: 0 auto 0 0; pointer-events: auto; z-index: 90; }
  .drawer-backdrop { display: none; }
  .drawer {
    transform: none; width: var(--sidebar-w);
    box-shadow: none; border-right: 1px solid var(--line);
  }
  .drawer-x { display: none; }
  .menu-btn { display: none !important; }
  /* desplazar el contenido para dejar el carril del sidebar */
  .pos-app, body.has-sidebar { padding-left: var(--sidebar-w); }

  /* Banda verde superior continua: el header del contenido (.hdr) y la
     cabecera del sidebar (.drawer-head) comparten altura exacta y se juntan
     a ras (sin esquinas redondeadas) para leerse como una sola barra. */
  .hdr, .drawer-head { height: 80px; min-height: 80px; }
  .hdr { border-radius: 0; padding-top: 0; padding-bottom: 0; }
  body.has-sidebar > header.hdr { display: flex; }
  body.has-sidebar .main-content { padding-top: 0; }
}
