/* Falak · Panel administrativo */
:root {
  --bg: #f5f3ee;
  --card: #ffffff;
  --ink: #17150f;
  --ink-2: #4a463c;
  --mute: #8a8476;
  --line: #e7e2d6;
  --line-2: #d9d2c2;
  --side: #0e0d0b;
  --gold: #b8892b;
  --gold-2: #d4af61;
  --gold-soft: #f6eedb;
  --ok: #1d8a5b;   --ok-bg: #e3f4ea;
  --warn: #b26b00; --warn-bg: #fff1d6;
  --bad: #c0392b;  --bad-bg: #fde6e3;
  --info: #2f5fb3; --info-bg: #e5edfb;
  --violet: #6a4bc4; --violet-bg: #eee8fb;
  --r: 14px;
  --shadow: 0 1px 2px rgba(23, 21, 15, .04), 0 6px 24px -12px rgba(23, 21, 15, .12);
  --mono: 'Geist Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 'Geist', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--mute); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Login ---------- */
/* ---------- Inicio de sesión: foto editorial + panel oscuro con el logo dorado ---------- */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); background: #0b0a08; color: #f3ead7; }
.login[hidden] { display: none; }
.login__art { position: relative; overflow: hidden; }
.login__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; animation: login-zoom 18s ease-out both; }
.login__art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 55%, #0b0a08), linear-gradient(0deg, #0b0a08cc, transparent 45%); }
.login__art blockquote { position: absolute; z-index: 1; left: clamp(28px, 5vw, 64px); bottom: clamp(28px, 6vh, 64px); margin: 0; font: italic 400 clamp(2rem, 3.6vw, 3.4rem)/1.05 'Bodoni Moda', serif; max-width: 12ch; }
.login__art blockquote em { color: #e9c877; }
.login__art blockquote span { display: block; margin-top: 14px; font: 600 .7rem 'Geist', sans-serif; letter-spacing: .32em; text-transform: uppercase; color: #c9b98f; font-style: normal; }
@keyframes login-zoom { from { scale: 1.08; } }

.login__panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 48px clamp(24px, 5vw, 64px); background: radial-gradient(700px 420px at 50% 0%, #2a2416aa, transparent 70%), #0b0a08; }
/* Logo animado (igual al de la portada del boceto Constelación): la estrella fugaz se dibuja sobre FALAK */
.lmark { position: relative; display: inline-block; text-align: center; padding-top: .42em; font-size: clamp(3.2rem, 5.4vw, 4.6rem); }
.lmark__word { display: block; font: 600 1em/.9 'Cinzel', serif; letter-spacing: .06em; margin-right: -.06em; background: linear-gradient(100deg, #8a6526 0%, #f7e08f 28%, #b98a3a 52%, #f3d27b 74%, #8a6526 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: lmark-shimmer 8s linear infinite; filter: drop-shadow(0 10px 40px #d4af6140); }
.lmark__sub { display: block; margin-top: .55rem; font: 600 clamp(.62rem, .9vw, .78rem) 'Geist', sans-serif; letter-spacing: .58em; text-transform: uppercase; color: #d4af61; padding-left: .58em; }
.lmark__arc { position: absolute; top: 0; left: -2%; width: 104%; height: .62em; overflow: visible; pointer-events: none; }
.lmark__trail { fill: none; stroke: url(#ltrail); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: lmark-draw 2s .3s cubic-bezier(.6,0,.2,1) forwards; }
.lmark__trail + .lmark__trail { animation-delay: .55s; }
.lmark__star { fill: url(#lstar); transform-box: fill-box; transform-origin: center; scale: 0; animation: lmark-star .9s 1.9s cubic-bezier(.3,1.6,.5,1) forwards, lmark-twinkle 3s 2.8s ease-in-out infinite; filter: drop-shadow(0 0 6px #f7e08f); }
@keyframes lmark-draw { to { stroke-dashoffset: 0; } }
@keyframes lmark-star { to { scale: 1; } }
@keyframes lmark-twinkle { 50% { scale: .82; rotate: 18deg; } }
@keyframes lmark-shimmer { to { background-position: -200% 0; } }
.login__card { width: min(400px, 100%); display: grid; gap: 10px; }
.login__eyebrow { margin: 0; font: 600 .7rem 'Geist', sans-serif; letter-spacing: .28em; text-transform: uppercase; color: #d4af61; }
.login__card h1 { margin: 0; font: 500 clamp(1.9rem, 3vw, 2.4rem)/1.08 'Bodoni Moda', serif; }
.login__sub { margin: 0 0 18px; color: #a99f8a; line-height: 1.55; font-size: .95rem; }
.login__label { font-size: .8rem; font-weight: 600; letter-spacing: .04em; color: #c9bfa8; }
.login__field { position: relative; }
.login__field svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.login__lock { position: absolute; left: 16px; top: 50%; translate: 0 -50%; color: #8d846f; pointer-events: none; }
#loginPass { width: 100%; height: 56px; padding: 0 54px 0 48px; border-radius: 14px; border: 1px solid #3a3326; background: #14120e; color: #f3ead7; font-size: 16px; letter-spacing: .02em; transition: border-color .2s, box-shadow .2s, background .2s; }
#loginPass::placeholder { color: #6f6758; letter-spacing: 0; }
#loginPass:focus { border-color: #d4af61; box-shadow: 0 0 0 4px #d4af6126; background: #18150f; outline: none; }
.login__eye { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: #a99f8a; cursor: pointer; transition: color .2s, background .2s; }
.login__eye:hover { color: #f3ead7; background: #ffffff0d; }
.login__eye:focus-visible { outline: 2px solid #d4af61; outline-offset: 0; }
.login__eye .eye-off, .login__eye[aria-pressed=true] .eye-on { display: none; }
.login__eye[aria-pressed=true] .eye-off { display: block; }
.login__caps { margin: 0; font-size: .8rem; color: #e9c877; }
.login__err { margin: 0; min-height: 1.3em; font-size: .88rem; color: #ff8a7a; }
.login__err:not(:empty) { animation: login-shake .35s; }
@keyframes login-shake { 25% { translate: -6px 0; } 75% { translate: 6px 0; } }
.login__btn { height: 56px; margin-top: 4px; border: 0; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; font: 600 1rem 'Geist', sans-serif; color: #17130b; cursor: pointer; background: linear-gradient(100deg, #b58a3a, #f2d68a 45%, #c99b45); background-size: 200% 100%; box-shadow: 0 12px 30px -12px #d4af6180; transition: background-position .6s, transform .15s, opacity .2s; }
.login__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; transition: translate .2s; }
.login__btn:hover { background-position: 100% 0; }
.login__btn:hover svg { translate: 4px 0; }
.login__btn:active { transform: scale(.98); }
.login__btn:disabled { opacity: .7; cursor: progress; }
.login__secure { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px 0 0; font-size: .78rem; color: #7f7766; }
.login__secure svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.login__store { font-size: .85rem; color: #a99f8a; text-decoration: none; }
.login__store:hover { color: #e9c877; }

/* Celular y tablet: la foto ocupa el fondo y el formulario sube como una tarjeta */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; position: relative; isolation: isolate; }
  .login__art { position: fixed; inset: 0; z-index: -1; }
  /* Foto completa de fondo; se oscurece hacia abajo, donde van el logo y el formulario */
  .login__art img { object-position: 50% 12%; }
  .login__art::after { background: linear-gradient(180deg, #0b0a0826 0%, #0b0a0800 22%, #0b0a0866 40%, #0b0a08dd 52%, #0b0a08 70%); }
  .login__art blockquote { display: none; }
  .login__panel { justify-content: flex-end; min-height: 100dvh; padding: max(32px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); background: none; gap: 18px; }
  .lmark { font-size: 2.9rem; margin-bottom: -6px; }
  .login__card { padding: 26px 22px 22px; border-radius: 24px; background: #14120ee6; border: 1px solid #ffffff14; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 -20px 60px -20px #000; }
  .login__card h1 { font-size: 1.85rem; }
  .login__sub { margin-bottom: 10px; }
}
/* Celulares bajitos (p. ej. iPhone SE): formulario más compacto para que se vea la cara */
@media (max-width: 900px) and (max-height: 740px) {
  .lmark { font-size: 2.4rem; }
  .login__sub { display: none; }
  .login__card { padding: 20px 20px 16px; gap: 8px; }
  .login__card h1 { font-size: 1.6rem; }
  #loginPass, .login__btn { height: 50px; }
  .login__panel { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) { .login__art img { animation: none; } }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--side); color: #cfc6b2; display: flex; flex-direction: column; padding: 20px 14px; gap: 18px; }
.side__brand { display: grid; justify-items: center; gap: 6px; padding: 6px 0 16px; border-bottom: 1px solid #221f18; text-decoration: none; }
.side__brand img { height: 52px; width: auto; filter: drop-shadow(0 6px 20px #d4af6133); }
.side__brand span { font-size: .62rem; letter-spacing: .28em; text-transform: uppercase; color: #6f6857; }
.side__nav { display: flex; flex-direction: column; gap: 2px; }
.side__nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.side__nav a:hover { background: #1a1813; color: #fff; }
.side__nav a.is-on { background: linear-gradient(90deg, #2a2416, #1a1813); color: var(--gold-2); box-shadow: inset 2px 0 0 var(--gold-2); }
.side__nav span { flex: 1; }
.pill { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 99px; background: var(--gold-2); color: #1a1408; font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; }
.pill:empty { display: none; }
.pill--warn { background: #e2683c; color: #fff; }
.side__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side__shops { display: flex; flex-direction: column; gap: 2px; font-size: .84rem; padding: 12px; border: 1px solid #221f18; border-radius: 12px; }
.side__shops span { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: #6f6857; margin-bottom: 4px; }
.side__shops a { text-decoration: none; padding: 3px 0; }
.side__shops a:hover { color: var(--gold-2); }
/* Usuario + cerrar sesión */
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 500 1rem 'Bodoni Moda', serif; color: #1a1408; background: linear-gradient(140deg, #f3e0b4, #c9a466); }
.side__me { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px; border: 1px solid #221f18; border-radius: 12px; background: #15130f; }
.side__me > div { flex: 1; min-width: 0; display: grid; }
.side__me b { color: #f3ead7; font-size: .86rem; }
.side__me small { color: #6f6857; font-size: .72rem; }
.side__logout { flex-basis: 100%; justify-content: center; display: inline-flex; align-items: center; gap: 6px; background: #1f1c16; border: 1px solid #2f2a20; color: #d9cfb8; border-radius: 9px; padding: 7px 10px; cursor: pointer; font-weight: 600; font-size: .78rem; transition: background .2s, color .2s, border-color .2s; }
.side__logout:hover { background: #3a1c16; border-color: #6b2f22; color: #ffb4a3; }
.side__logout svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.side__shops a { font-size: .82rem; }
.nav-more, .mbar { display: none; }

/* Gráfica de ventas en HTML (nítida a cualquier tamaño) */
.bars { display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 6px; height: 270px; padding: 22px 4px 0; background: repeating-linear-gradient(to top, transparent 0 25%, var(--line) 25% calc(25% + 1px)); background-size: 100% calc(100% - 22px); background-position: 0 0; background-repeat: no-repeat; }
.bars__col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; cursor: default; }
.bars__col i { width: min(100%, 30px); border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #e3c27a, #b8892b); transition: filter .2s; display: block; }
.bars__col:hover i { filter: brightness(1.12); }
.bars__col.is-today i { background: linear-gradient(180deg, #2a2416, #0e0d0b); box-shadow: 0 0 0 2px #d4af61 inset; }
.bars__val { font: 600 .66rem var(--mono); color: var(--mute); min-height: 1em; }
.bars__col small { font-size: .72rem; color: var(--mute); }
.bars__col.is-today small { color: var(--ink); font-weight: 700; }

/* Stock por talla en las tarjetas de producto */
.sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 6px; }
.size { display: grid; justify-items: center; gap: 1px; padding: 4px 0 5px; border-radius: 8px; background: var(--bg); font: 600 .84rem var(--mono); }
.size em { font: 600 .6rem 'Geist', sans-serif; font-style: normal; letter-spacing: .08em; color: var(--mute); }
.size.is-low { background: #fbf0d9; color: #8a5a00; }
.size.is-out { background: #fde4e0; color: #b4231a; }

/* Hoja "Más" (celular) */
.sheet { margin: auto 0 0; width: 100%; max-width: none; max-height: 88dvh; border: 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--card); color: var(--ink); translate: 0 100%; transition: translate .35s cubic-bezier(.2,.8,.2,1), overlay .35s allow-discrete, display .35s allow-discrete; }
.sheet[open] { translate: 0 0; }
@starting-style { .sheet[open] { translate: 0 100%; } }
.sheet::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(3px); }
.sheet__grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 4px auto 14px; }
.sheet__me { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; border-bottom: 1px solid var(--line); }
.sheet__me div { display: grid; }
.sheet__me small { color: var(--mute); font-size: .8rem; }
.sheet__nav { display: grid; padding: 8px 0; }
.sheet__nav a { display: flex; align-items: center; gap: 14px; padding: 14px 8px; border-radius: 12px; text-decoration: none; font-weight: 600; font-size: 1.02rem; }
.sheet__nav a.is-on { background: var(--bg); color: var(--gold); }
.sheet__nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.sheet__label { margin: 6px 8px 8px; font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); font-weight: 600; }
.sheet__shops { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 16px; }
.sheet__shops a { padding: 8px 12px; border-radius: 99px; background: var(--bg); text-decoration: none; font-size: .86rem; font-weight: 600; }
.sheet__logout { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: 14px; border: 1px solid #f3c9c0; background: #fdf0ed; color: #b4231a; font-weight: 700; font-size: 1rem; cursor: pointer; }
.sheet__logout svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; }

.main { min-width: 0; padding: 26px clamp(16px, 3vw, 40px) 60px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.top__eyebrow { margin: 0; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.top__title { margin: 2px 0 0; font: 500 clamp(1.7rem, 3vw, 2.3rem)/1.1 'Bodoni Moda', serif; letter-spacing: -.01em; }
.top__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Componentes ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-weight: 600; font-size: .88rem; text-decoration: none; white-space: nowrap; transition: border-color .15s, background .15s, transform .1s; }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--dark:hover { background: #2c281e; }
.btn--gold { background: linear-gradient(135deg, #d9b766, #b8892b); color: #1a1408; border-color: #b8892b; }
.btn--gold:hover { filter: brightness(1.05); border-color: #8f6a1e; }
.btn--ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn--danger { color: var(--bad); }
.btn--danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn--wa { background: #25d366; border-color: #1fb956; color: #08361a; }
.btn--sm { height: 30px; padding: 0 10px; font-size: .8rem; border-radius: 8px; }
.btn--block { width: 100%; height: 44px; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--bg); border-color: var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; flex-wrap: wrap; }
.card__head h2, .card__head h3 { margin: 0; font-size: 1rem; font-weight: 650; }
.card__body { padding: 16px 18px 18px; }
.grid { display: grid; gap: 18px; }
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--2 { grid-template-columns: 1.6fr 1fr; }
.grid--2e { grid-template-columns: 1fr 1fr; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi__label { font-size: .76rem; color: var(--mute); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.kpi__value { font: 600 1.65rem/1.15 'Geist', sans-serif; letter-spacing: -.02em; }
.kpi__sub { font-size: .8rem; color: var(--mute); }
.kpi--gold { background: linear-gradient(135deg, #1a1712, #2b2416); color: #f3ead7; border-color: #2b2416; }
.kpi--gold .kpi__label, .kpi--gold .kpi__sub { color: #c9b98f; }
.kpi--gold .kpi__value { color: var(--gold-2); }
.kpi[data-go] { cursor: pointer; }
.kpi[data-go]:hover { border-color: var(--gold); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: .74rem; font-weight: 650; white-space: nowrap; background: var(--bg); color: var(--ink-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-violet { background: var(--violet-bg); color: var(--violet); }
.b-gold { background: var(--gold-soft); color: #8a6417; }
.b-mute { background: #efece5; color: var(--mute); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding: 0 18px; }
.tabs button { background: none; border: 0; padding: 12px 10px; cursor: pointer; font-weight: 600; color: var(--mute); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; }
.tabs button.is-on { color: var(--ink); border-color: var(--gold); }
.tabs button i { font-style: normal; font-size: .72rem; background: var(--bg); padding: 1px 7px; border-radius: 99px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 18px; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; color: var(--mute); }
/* Más específico que la regla general de inputs, que si no anula el espacio del ícono */
.search input:not([type=checkbox]):not([type=radio]):not([type=color]) { padding-left: 36px; }

input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea { width: 100%; height: 38px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; padding: 0 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 137, 43, .15); }
input[type=color] { width: 44px; height: 38px; border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; background: #fff; cursor: pointer; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ink); cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--mute); font-size: .76rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .span { grid-column: 1 / -1; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; cursor: pointer; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: translate .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { translate: 16px 0; }

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fbfaf7; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; transition: background .12s; }
tbody tr.click:hover { background: #fbf8f1; }
.thumb { width: 42px; height: 52px; border-radius: 8px; object-fit: cover; object-position: top; background: var(--bg); display: block; }
.thumb--sm { width: 34px; height: 42px; border-radius: 6px; }
.cell-prod { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.cell-prod b { display: block; font-weight: 600; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); vertical-align: -1px; margin-right: 5px; }
.empty { padding: 44px 20px; text-align: center; color: var(--mute); }
.empty svg { width: 34px; height: 34px; color: var(--line-2); margin-bottom: 6px; }

/* Stock */
.stock-in { width: 62px !important; height: 34px !important; text-align: center; padding: 0 4px !important; font-family: var(--mono); font-weight: 500; }
.stock-in.is-low { border-color: #f0b35a; background: #fff8ea; }
.stock-in.is-out { border-color: #eb9a90; background: #fff1ef; color: var(--bad); }
.stock-in.is-dirty { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184, 137, 43, .18); }
.chip-stock { display: inline-grid; place-items: center; min-width: 30px; height: 24px; border-radius: 6px; font: 500 .8rem var(--mono); background: var(--bg); padding: 0 6px; }
.chip-stock.is-low { background: var(--warn-bg); color: var(--warn); }
.chip-stock.is-out { background: var(--bad-bg); color: var(--bad); }

/* Gráfica */
.chart { width: 100%; height: 220px; display: block; }
.chart .bar { fill: url(#gold); transition: opacity .15s; }
.chart .bar:hover { opacity: .75; }
.chart text { font: 11px 'Geist', sans-serif; fill: var(--mute); }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.hbar { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; margin: 10px 0; font-size: .86rem; }
.hbar__track { height: 10px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.hbar__fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d9b766, #b8892b); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--warn-bg); color: #6b4300; border: 1px solid #f2d79c; margin-bottom: 18px; flex-wrap: wrap; }
.alert--info { background: var(--gold-soft); border-color: #ead7a6; color: #5a4310; }
.alert--bad { background: var(--bad-bg); border-color: #f3c0b9; color: #7a1d12; }
.alert p { margin: 0; flex: 1; min-width: 200px; }

/* Kanban despachos */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.col { background: #ece8de; border-radius: var(--r); padding: 12px; min-height: 300px; display: flex; flex-direction: column; gap: 10px; transition: background .15s, outline-color .15s; outline: 2px dashed transparent; outline-offset: -4px; }
.col.is-over { background: #e4dcc8; outline-color: var(--gold); }
.col__head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; }
.col__head h3 { margin: 0; font-size: .86rem; letter-spacing: .04em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.col__head h3 i { width: 9px; height: 9px; border-radius: 50%; }
.col__count { font: 600 .8rem var(--mono); color: var(--mute); }
.ship { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: grab; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); transition: box-shadow .15s, transform .15s; }
.ship:hover { box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .25); }
.ship.is-dragging { opacity: .5; transform: rotate(2deg); }
.ship__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.ship__ref { font: 500 .78rem var(--mono); color: var(--mute); }
.ship__name { font-weight: 650; margin: 0; }
.ship__city { font-size: .82rem; color: var(--mute); margin: 0 0 8px; }
.ship__items { display: flex; gap: 4px; margin-bottom: 10px; }
.ship__items img { width: 30px; height: 38px; border-radius: 5px; object-fit: cover; object-position: top; }
.ship__items span { font-size: .78rem; color: var(--ink-2); align-self: center; margin-left: 4px; }
.ship__foot { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.ship__age { font-size: .74rem; color: var(--mute); }
.ship__age.is-late { color: var(--bad); font-weight: 650; }

/* Productos */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.pcard { overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .35); }
.pcard__img { aspect-ratio: 4 / 5; background: var(--bg); position: relative; }
.pcard__img img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.pcard__img .badge { position: absolute; top: 10px; left: 10px; }
.pcard__img.is-off img { filter: grayscale(1); opacity: .55; }
.pcard__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.pcard__body b { font-weight: 650; }
.pcard__row { display: flex; justify-content: space-between; align-items: center; font-size: .84rem; }
.pcard--new { border: 2px dashed var(--line-2); display: grid; place-items: center; min-height: 320px; color: var(--mute); background: transparent; box-shadow: none; font-weight: 600; text-align: center; }
.pcard--new:hover { border-color: var(--gold); color: var(--gold); }

.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.imgs__item { position: relative; aspect-ratio: 4 / 5; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.imgs__item img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.imgs__item:first-child { outline: 2px solid var(--gold); outline-offset: 1px; }
.imgs__item:first-child::after { content: 'Portada'; position: absolute; left: 6px; bottom: 6px; font-size: .66rem; font-weight: 700; background: var(--gold); color: #1a1408; padding: 1px 6px; border-radius: 5px; }
.imgs__tools { position: absolute; inset: 4px 4px auto auto; display: flex; gap: 3px; }
.imgs__tools button { width: 24px; height: 24px; border-radius: 6px; border: 0; background: rgba(14, 13, 11, .75); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 12px; }
.drop { border: 2px dashed var(--line-2); border-radius: 10px; display: grid; place-items: center; text-align: center; color: var(--mute); font-size: .8rem; cursor: pointer; aspect-ratio: 4 / 5; padding: 8px; transition: border-color .15s, background .15s; }
.drop:hover, .drop.is-over { border-color: var(--gold); background: var(--gold-soft); color: #8a6417; }

/* Drawer / modal */
dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(14, 13, 11, .45); backdrop-filter: blur(3px); }
.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(620px, 100vw); background: var(--bg); box-shadow: -20px 0 60px -20px rgba(0, 0, 0, .3); }
.drawer[open] { animation: slide .25s ease-out; }
@keyframes slide { from { translate: 40px 0; opacity: 0; } }
.drawer__head { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 18px 22px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.drawer__head h2 { margin: 0; font: 600 1.2rem var(--mono); letter-spacing: -.01em; }
.drawer__head p { margin: 2px 0 0; color: var(--mute); font-size: .84rem; }
.drawer__body { padding: 18px 22px 40px; display: flex; flex-direction: column; gap: 14px; }
.drawer .card__body { padding: 14px 16px; }
.modal { width: min(560px, calc(100vw - 24px)); border-radius: 18px; background: var(--card); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .4); max-height: calc(100vh - 32px); }
.modal--wide { width: min(860px, calc(100vw - 24px)); }
.modal[open] { animation: pop .2s ease-out; }
@keyframes pop { from { scale: .97; opacity: 0; } }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal__head h2 { margin: 0; font: 500 1.35rem 'Bodoni Moda', serif; }
.modal__body { padding: 20px 22px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); flex-wrap: wrap; }
.x { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); cursor: pointer; display: grid; place-items: center; flex: none; }
.x:hover { border-color: var(--ink-2); }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; font-size: .88rem; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; word-break: break-word; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.items li:last-child { border: 0; }
.items .grow { flex: 1; }
.totals { margin: 10px 0 0; display: grid; gap: 4px; font-size: .9rem; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-weight: 700; font-size: 1.05rem; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 4px 0 14px; }
.step { text-align: center; position: relative; font-size: .74rem; color: var(--mute); font-weight: 600; }
.step i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 6px; background: var(--bg); border: 2px solid var(--line-2); font-style: normal; font-size: .78rem; position: relative; z-index: 1; }
.step::before { content: ''; position: absolute; top: 13px; left: -50%; right: 50%; height: 2px; background: var(--line-2); }
.step:first-child::before { display: none; }
.step.is-done { color: var(--ink); }
.step.is-done i { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.is-done::before { background: var(--ok); }
.step.is-now i { border-color: var(--gold); background: var(--gold-soft); color: #8a6417; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: .86rem; }
.timeline li::before { content: ''; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.timeline li::after { content: ''; position: absolute; left: 3.5px; top: 16px; bottom: 0; width: 1px; background: var(--line-2); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; color: var(--mute); font-size: .76rem; }
.note { background: #fffbea; border: 1px solid #f1e3a6; border-radius: 10px; padding: 8px 12px; font-size: .86rem; margin-bottom: 8px; }
.note time { display: block; font-size: .72rem; color: var(--mute); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row--between { justify-content: space-between; }

/* Toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--side); color: #f3ead7; padding: 12px 16px; border-radius: 12px; box-shadow: 0 14px 40px -14px rgba(0, 0, 0, .5); font-weight: 500; display: flex; gap: 10px; align-items: center; max-width: 360px; animation: pop .2s ease-out; border-left: 3px solid var(--gold-2); }
.toast--bad { border-left-color: #ff7a66; }

/* Impresión de rótulos / lista de alistamiento */
.print-area { display: none; }
@media print {
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block; color: #000; font: 12px/1.4 'Geist', sans-serif; }
  .label { border: 1.5px solid #000; border-radius: 6px; padding: 14px 16px; margin: 0 0 14px; page-break-inside: avoid; break-inside: avoid; }
  .label__head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #000; padding-bottom: 8px; margin-bottom: 10px; }
  .label__head img { height: 46px; }
  .label__to { font-size: 15px; }
  .label__to b { font-size: 18px; display: block; }
  .label table th, .label table td { padding: 4px 6px; border-bottom: 1px solid #ccc; background: none; font-size: 11px; color: #000; }
  .label .ref { font: 600 16px var(--mono); }
  .pick h1 { font: 500 22px 'Bodoni Moda', serif; margin: 0 0 4px; }
  .pick table th, .pick table td { border: 1px solid #999; padding: 6px 8px; color: #000; background: none; }
  .pick .box { width: 16px; height: 16px; border: 1.5px solid #000; display: inline-block; }
}

/* ---------- Responsive: el panel también se usa desde el celular ---------- */
@media (max-width: 1100px) {
  .grid--2, .grid--2e { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 50; border-top: 1px solid #221f18; }
  .side__brand, .side__foot, .side__nav .nav-extra { display: none; }
  .nav-more { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; padding: 6px 4px; background: none; border: 0; color: inherit; font: 500 .7rem 'Geist', sans-serif; cursor: pointer; border-radius: 10px; }
  .nav-more svg { width: 22px; height: 22px; fill: currentColor; }
  .nav-more.is-on { color: var(--gold-2); box-shadow: inset 0 2px 0 var(--gold-2); }
  .mbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 40; margin: -18px -14px 14px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: rgb(14 13 11 / .94); backdrop-filter: blur(12px); }
  .mbar img { height: 34px; width: auto; display: block; }
  .mbar__me { display: flex; align-items: center; gap: 4px; background: #1f1c16; border: 1px solid #2f2a20; border-radius: 99px; padding: 3px 8px 3px 3px; color: #d9cfb8; cursor: pointer; }
  .mbar__me .avatar { width: 30px; height: 30px; font-size: .9rem; }
  .mbar__me svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
  .bars { height: 190px; gap: 3px; }
  .bars__val { display: none; }
  .bars__col small { font-size: .62rem; }
  .grid--kpi > :last-child:nth-child(odd) { grid-column: span 2; }
  .side__nav { flex-direction: row; justify-content: space-around; width: 100%; }
  .side__nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: .7rem; position: relative; flex: 1; text-align: center; }
  .side__nav a.is-on { box-shadow: inset 0 2px 0 var(--gold-2); }
  .side__nav .pill { position: absolute; top: 0; right: 50%; translate: 22px 0; height: 16px; min-width: 16px; font-size: .62rem; padding: 0 4px; }
  .main { padding: 18px 14px 96px; }
  .board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 100px 1fr; }
  .hide-sm { display: none; }
  td, th { padding: 10px; }
  .grid { gap: 12px; }
  .grid--kpi { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px 14px; }
  .kpi__value { font-size: 1.35rem; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 0 8px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; white-space: nowrap; }
  .pgrid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pcard--new { grid-column: 1 / -1; min-height: 0; padding: 16px; display: flex; flex-direction: row; justify-content: center; gap: 8px; }
  .top__actions .btn { flex: 1 1 auto; justify-content: center; }
  /* Pedidos: cada fila se vuelve una tarjeta compacta */
  .t-orders thead { display: none; }
  .t-orders tbody { display: block; }
  .t-orders tr { display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; row-gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .t-orders td { padding: 0; border: 0; min-width: 0; }
  .t-orders .c-sel { grid-column: 1; grid-row: 1 / span 3; padding-top: 2px; }
  .t-orders .c-ref { grid-column: 2; grid-row: 1; }
  .t-orders .c-cli { grid-column: 2; grid-row: 2; }
  .t-orders .c-total { grid-column: 3; grid-row: 1 / span 2; }
  .t-orders .c-pay { grid-column: 2; grid-row: 3; }
  .t-orders .c-ful { grid-column: 3; grid-row: 3; justify-self: end; }
}


/* ---------- Notificaciones ---------- */
.top { position: relative; }
.bell { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--card); display: grid; place-items: center; cursor: pointer; color: var(--ink); flex: none; }
.bell:hover { border-color: var(--gold); }
.bell svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.bell b { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: #e2683c; color: #fff; font: 700 .68rem 'Geist', sans-serif; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); animation: bellpop .4s cubic-bezier(.3,1.6,.5,1); }
.bell b:empty { display: none; }
@keyframes bellpop { from { scale: 0; } }
.bell--top { order: 3; }
.mbar__tools { display: flex; align-items: center; gap: 8px; }
.mbar .bell { width: 38px; height: 38px; background: #1f1c16; border-color: #2f2a20; color: #d9cfb8; }
.mbar .bell b { box-shadow: 0 0 0 2px #0e0d0b; }

.notif { position: fixed; inset: 18px 18px auto auto; margin: 0; max-width: none; width: min(400px, calc(100vw - 24px)); max-height: min(640px, calc(100dvh - 36px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .35); display: none; flex-direction: column; overflow: hidden; }
.notif[open] { display: flex; animation: notifIn .25s cubic-bezier(.2,.8,.2,1); }
@keyframes notifIn { from { opacity: 0; translate: 0 -8px; } }
.notif::backdrop { background: rgb(0 0 0 / .18); }
.notif__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.notif__x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--bg); cursor: pointer; }
.notif__push { padding: 12px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; font-size: .82rem; color: var(--mute); }
.notif__push p { margin: 0; }
.notif__push .ok { color: #1f7a4d; font-weight: 600; }
.notif__push .switch { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; }
.notif__list { list-style: none; margin: 0; padding: 6px; overflow: auto; }
.nitem { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: start; padding: 10px; border-radius: 12px; cursor: pointer; }
.nitem:hover, .nitem:focus-visible { background: var(--bg); outline: none; }
.nitem i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: .9rem; }
.nitem--ok i { background: #e3f4ea; color: #1f7a4d; }
.nitem--warn i { background: #fbf0d9; color: #8a5a00; }
.nitem--bad i { background: #fde4e0; color: #b4231a; }
.nitem--stock i { background: #f1ece2; color: #6b5530; }
.nitem div { display: grid; min-width: 0; }
.nitem b { font-size: .9rem; }
.nitem span { font-size: .8rem; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nitem small { font-size: .72rem; color: var(--mute); white-space: nowrap; }
.nitem.is-new { background: #fbf6ea; }
.nitem.is-new b::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #e2683c; margin-left: 6px; vertical-align: middle; }
.nempty { padding: 28px 18px; text-align: center; color: var(--mute); font-size: .88rem; line-height: 1.6; }
@media (max-width: 860px) {
  .bell--top { display: none; }
  .notif { inset: auto 0 0 0; width: 100%; max-width: none; max-height: 82dvh; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .notif[open] { animation: sheetUp .3s cubic-bezier(.2,.8,.2,1); }
  @keyframes sheetUp { from { translate: 0 100%; } }
}
.top { justify-content: flex-start; align-items: center; }
.top > div:first-child { margin-right: auto; }
