/* ── Panel administrativo ── */
body.admin { background: #f8f4ec; }
.eyebrow { display: inline-block; font-size: 11.5px; letter-spacing: 2.2px; text-transform: uppercase; color: var(--gold-600); font-weight: 600; }
.small { font-size: 13px; }
[data-icon] { display: inline-flex; }
[data-icon] svg { width: 18px; height: 18px; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; background:
  radial-gradient(600px 400px at 20% 20%, rgba(217,191,127,.35), transparent 70%),
  radial-gradient(500px 400px at 90% 90%, rgba(233,185,189,.28), transparent 70%), var(--ink);
  display: grid; place-items: center; color: #f3e9cf; overflow: hidden; }
.login-art::before { content: ''; position: absolute; inset: 24px; border: 1px solid rgba(217,191,127,.35); border-radius: 28px; }
.login-art-in { text-align: center; position: relative; }
.login-art img { width: 160px; height: 160px; border-radius: 50%; background: #fff; margin: 0 auto 22px; object-fit: contain; box-shadow: 0 20px 60px -20px rgba(0,0,0,.6); }
.login-art h2 { font-size: 52px; color: #fff; }
.login-art p { color: #cfc2a8; letter-spacing: .5px; }
.login-card { align-self: center; justify-self: center; width: min(92%, 400px); display: grid; gap: 4px; }
.login-card h1 { font-size: 40px; }
.login-card > p { margin: 4px 0 22px; }
.login-logo { display: none; width: 84px; height: 84px; border-radius: 50%; margin-bottom: 10px; border: 1px solid var(--gold-100); object-fit: contain; background: #fff; }
.login-err { background: var(--red-50); color: var(--red); padding: 10px 14px; border-radius: 12px; font-size: 13.5px; margin: 0 0 12px; }
.back-store { display: inline-flex; gap: 6px; align-items: center; justify-content: center; margin-top: 18px; color: var(--ink-3); font-size: 13.5px; }
.back-store:hover { color: var(--gold-700); }

/* Layout */
.app { display: grid; grid-template-columns: 258px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--ink); color: #e9e1d3; display: flex; flex-direction: column; padding: 22px 16px; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 18px; }
.side-brand img { width: 46px; height: 46px; border-radius: 50%; background: #fff; object-fit: contain; }
.side-brand strong { display: block; font-size: 21px; color: #fff; line-height: 1.1; }
.side-brand small { font-size: 10.5px; letter-spacing: 2.4px; text-transform: uppercase; color: var(--gold-300); }
.side-nav { display: grid; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: #cfc4b2; font-weight: 500; font-size: 14.5px; transition: background .2s, color .2s; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: linear-gradient(135deg, rgba(201,162,76,.25), rgba(201,162,76,.08)); color: #fff; box-shadow: inset 3px 0 0 var(--gold-300); }
.side-nav a.nav-cta { margin-top: 8px; background: linear-gradient(135deg, #c9a24c, #a9842f); color: #fff; box-shadow: 0 8px 20px -10px rgba(201,162,76,.8); }
.side-nav a.nav-cta.active { box-shadow: 0 0 0 2px rgba(255,255,255,.25), 0 8px 20px -10px rgba(201,162,76,.8); }
.side-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.side-link { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; color: #b5a996; background: none; border: 0; cursor: pointer; font-size: 14px; text-align: left; }
.side-link:hover { color: #fff; background: rgba(255,255,255,.05); }

.main { padding: 30px 36px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 44px; font-weight: 600; margin-top: 2px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpis-3 { grid-template-columns: repeat(3, 1fr); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; display: grid; gap: 6px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm); }
.kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi-label { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.kpi-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-50); color: var(--gold-600); }
.kpi-ico svg { width: 19px; height: 19px; }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -.5px; line-height: 1.1; }
.kpi-sub { font-size: 12.5px; color: var(--ink-3); }
.kpi.dark { background: linear-gradient(135deg, #2a231c, #45392c); color: #fff; border-color: transparent; }
.kpi.dark .kpi-label, .kpi.dark .kpi-sub { color: #cdbfa8; }
.kpi.dark .kpi-ico { background: rgba(255,255,255,.1); color: var(--gold-300); }

/* Panels */
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.span-2 { grid-column: span 2; }
.panel { padding: 20px 22px; border-radius: 18px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.panel-head h3 { font-size: 15.5px; font-weight: 600; }
.chart { height: 240px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .bar { fill: var(--gold-300); transition: fill .2s; }
.chart .bar:hover, .chart .bar.today { fill: var(--gold); }
.chart text { font-size: 10.5px; fill: var(--ink-3); font-family: var(--sans); }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 4; }

.mini-list { display: grid; gap: 4px; }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-radius: 10px; }
.mini-row + .mini-row { border-top: 1px solid var(--line); }
.mini-row img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none; background: var(--gold-50); }
.mini-row .grow { flex: 1; min-width: 0; }
.mini-row .t { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .s { font-size: 12px; color: var(--ink-3); }
.mini-row .v { font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.bar-row { display: grid; gap: 6px; padding: 8px 0; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 13.5px; }
.bar-track { height: 8px; border-radius: 99px; background: var(--gold-50); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold-300), var(--gold)); }

/* Toolbar */
.toolbar { display: flex; gap: 10px; padding: 12px; border-radius: 18px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1 1 240px; }
.toolbar .select { width: auto; min-width: 150px; }
.toolbar input[type=date] { width: auto; }
.price-range { display: flex; gap: 6px; }
.price-range .input { width: 120px; }
.seg { display: inline-flex; background: #f3ede2; border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 36px; padding: 0 12px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.inv-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.inv-stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; display: flex; gap: 10px; align-items: baseline; cursor: pointer; transition: border-color .2s; }
.inv-stat:hover { border-color: var(--gold-300); }
.inv-stat strong { font-size: 18px; }
.inv-stat span { font-size: 12.5px; color: var(--ink-3); }

/* Tabla */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: auto; box-shadow: var(--shadow-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 14px 16px; background: #fcf9f3; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: #fdfaf4; }
.tbl .num { text-align: right; white-space: nowrap; }
.prod-cell { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.prod-cell img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--gold-50); flex: none; cursor: zoom-in; }
.prod-cell .t { font-weight: 500; line-height: 1.3; }
.prod-cell .s { font-size: 12px; color: var(--ink-3); }
.price-edit { width: 120px; height: 36px; text-align: right; border-radius: 10px; font-weight: 600; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: #fff; }
.stepper button { width: 32px; height: 34px; border: 0; background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.stepper button:hover { background: var(--gold-50); color: var(--gold-700); }
.stepper button svg { width: 15px; height: 15px; }
.stepper input { width: 46px; height: 34px; border: 0; text-align: center; font-weight: 600; outline: none; border-left: 1px solid var(--line); border-right: 1px solid var(--line); -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Tarjetas inventario */
.inv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.inv-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.inv-card .media { position: relative; aspect-ratio: 4/3; background: var(--gold-50); }
.inv-card .media img { width: 100%; height: 100%; object-fit: cover; }
.inv-card .media .badge { position: absolute; top: 10px; left: 10px; }
.inv-card .body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.inv-card .t { font-weight: 500; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.inv-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* POS */
.pos { display: grid; grid-template-columns: 1fr 400px; gap: 20px; align-items: start; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.pos-item { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; text-align: left; padding: 0; transition: transform .15s var(--ease), box-shadow .2s, border-color .2s; position: relative; }
.pos-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--gold-300); }
.pos-item:active { transform: scale(.98); }
.pos-item img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: var(--gold-50); }
.pos-item .b { padding: 9px 11px 11px; display: grid; gap: 2px; }
.pos-item .t { font-size: 13px; font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.pos-item .p { font-weight: 600; font-size: 14px; }
.pos-item .st { font-size: 11.5px; color: var(--ink-3); }
.pos-item .add { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.95); display: grid; place-items: center; box-shadow: var(--shadow-sm); color: var(--gold-700); }
.pos-item .add svg { width: 17px; height: 17px; }
.pos-item .incart { position: absolute; top: 8px; left: 8px; }
.pos-item.out { opacity: .6; }

.cart { position: sticky; top: 20px; padding: 20px; border-radius: 22px; display: grid; gap: 14px; box-shadow: var(--shadow); max-height: calc(100vh - 40px); overflow: auto; }
.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-head h3 { font-size: 28px; }
.cart-items { display: grid; gap: 10px; }
.cart-empty { text-align: center; padding: 26px 10px; color: var(--ink-3); border: 1.5px dashed var(--line-2); border-radius: 16px; font-size: 13.5px; }
.cart-empty svg { width: 34px; height: 34px; color: var(--gold-300); margin: 0 auto 8px; }
.ci { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; }
.ci img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--gold-50); }
.ci .t { font-size: 13px; font-weight: 500; line-height: 1.25; }
.ci .meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.ci .unit { width: 100px; height: 32px; font-size: 13px; text-align: right; border-radius: 9px; padding: 0 8px; }
.ci .sub { font-weight: 600; font-size: 14px; text-align: right; }
.ci .rm { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 4px; margin-top: 6px; }
.ci .rm:hover { color: var(--red); }
.ci .rm svg { width: 16px; height: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.cart-form .field { margin-bottom: 10px; }
.cart-total { background: var(--gold-50); border-radius: 16px; padding: 14px 16px; display: grid; gap: 6px; font-size: 14px; }
.cart-total > div { display: flex; justify-content: space-between; }
.cart-total .grand { border-top: 1px solid var(--gold-100); padding-top: 8px; margin-top: 2px; font-size: 16px; font-weight: 600; align-items: baseline; }
.cart-total .grand strong { font-size: 30px; letter-spacing: -.5px; color: var(--ink); }

/* Ventas */
.sale-row { cursor: pointer; }
.sale-items { background: #fcf9f3; }
.sale-items td { padding: 0 16px 14px 16px; }
.sale-items ul { list-style: none; margin: 0; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 6px; font-size: 13.5px; }
.sale-items li { display: flex; justify-content: space-between; gap: 10px; }
.method { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.method::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--gold)); }

/* Modal producto */
.pf-grid { display: grid; grid-template-columns: 220px 1fr; gap: 22px; }
.pf-media { display: grid; gap: 10px; align-content: start; }
.drop { aspect-ratio: 1/1; border: 1.5px dashed var(--gold-300); border-radius: 18px; background: var(--gold-50); display: grid; place-items: center; cursor: pointer; overflow: hidden; position: relative; transition: background .2s, border-color .2s; }
.drop:hover, .drop.over { background: var(--gold-100); border-color: var(--gold); }
.drop img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.drop-hint { display: grid; justify-items: center; gap: 4px; color: var(--gold-700); text-align: center; padding: 10px; }
.drop-hint svg { width: 28px; height: 28px; }
.drop-hint small { color: var(--ink-3); font-size: 11.5px; }
.drop.loading::after { content: 'Subiendo…'; position: absolute; inset: 0; background: rgba(255,255,255,.8); display: grid; place-items: center; font-weight: 500; }
.margin { height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 12px; background: #f6f1e8; font-weight: 600; font-size: 14px; }

/* Lightbox */
.lightbox img { max-height: 80vh; width: 100%; object-fit: contain; border-radius: 16px; }

.bottom-nav { display: none; }

@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .pos { grid-template-columns: 1fr 360px; }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-logo { display: block; }
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 18px 14px 100px; }
  .page-head h1 { font-size: 34px; }
  .dash-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .pos { grid-template-columns: 1fr; }
  .cart { position: static; max-height: none; }
  .pf-grid { grid-template-columns: 1fr; }
  .pf-media { grid-template-columns: 140px 1fr; align-items: start; }
  .drop { grid-row: span 3; }
  .toolbar .select, .toolbar input[type=date] { flex: 1 1 140px; }
  .price-range { flex: 1 1 100%; }
  .price-range .input { width: 100%; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: rgba(42,35,28,.97); backdrop-filter: blur(10px); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: grid; justify-items: center; gap: 3px; color: #b5a996; font-size: 11px; padding: 6px 0; border-radius: 12px; }
  .bottom-nav a.active { color: #fff; background: rgba(255,255,255,.07); }
  .bottom-nav a.bn-cta { color: #fff; }
  .bottom-nav a.bn-cta [data-icon] { background: linear-gradient(135deg, #c9a24c, #a9842f); border-radius: 10px; padding: 4px 12px; }
}
@media (max-width: 560px) {
  .kpis, .kpis-3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 21px; }
  .kpi-ico { display: none; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .pos-grid { grid-template-columns: repeat(2, 1fr); }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
}

/* Logo horizontal */
.side-brand { flex-direction: column; align-items: flex-start; gap: 6px; }
.side-brand img { width: 160px; height: auto; border-radius: 0; background: none; }
.login-art img.login-wide { width: min(380px, 70%); height: auto !important; border-radius: 0 !important; background: none !important; box-shadow: none !important; margin: 0 auto 18px !important; }
.login-logo { width: 190px !important; height: auto !important; border-radius: 0 !important; border: 0 !important; background: none !important; }

/* Precios por medida */
.variants-box { background: #fcf9f3; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.vb-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.vb-actions { display: flex; gap: 6px; }
#pfVariants { display: grid; gap: 8px; margin-top: 10px; }
#pfVariants:empty { margin-top: 0; }
.vrow { display: grid; grid-template-columns: 1fr 150px auto; gap: 8px; align-items: center; }
.vrow .input { height: 40px; }
.vb-hint { margin: 8px 0 0; }
.var-pill { display: inline-grid; justify-items: end; gap: 0; border: 1px dashed var(--gold-300); background: var(--gold-50); border-radius: 10px; padding: 5px 12px; cursor: pointer; min-width: 120px; }
.var-pill strong { font-size: 13.5px; }
.var-pill span { font-size: 11.5px; color: var(--gold-700); }
.var-pill:hover { border-style: solid; }
.var-pill.wide { width: 100%; justify-items: start; }
.vm-list { display: grid; gap: 8px; }
.vm-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border: 1.5px solid var(--line-2); border-radius: 14px; background: #fff; cursor: pointer; font-size: 15px; transition: all .15s; }
.vm-item:hover { border-color: var(--gold); background: var(--gold-50); }
.vm-item strong { font-weight: 600; }
