/* Panel de administración */

.admin-body {
  background:
    radial-gradient(60% 40% at 100% 0%, rgba(240, 132, 42, 0.1), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.small {
  font-size: 0.85rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* ingreso */
.login {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  padding: 34px 28px;
  text-align: center;
}
.login-card img {
  width: 150px;
  height: 150px;
  margin: -8px auto 6px;
  filter: drop-shadow(0 18px 40px rgba(240, 132, 42, 0.35));
}
.login-card h1 {
  font-size: 2rem;
  margin-bottom: 6px;
}
.login-card form {
  text-align: left;
  margin-top: 22px;
}

/* estructura */
.shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100svh;
}
.side {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(17, 13, 11, 0.7);
  backdrop-filter: blur(14px);
}
.side .brand {
  padding: 0 8px;
}
.side-nav {
  display: grid;
  gap: 4px;
}
.side-nav button,
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.2s;
  text-align: left;
}
.side-nav button:hover,
.side-link:hover {
  color: var(--text);
  background: rgba(255, 240, 220, 0.04);
}
.side-nav button.on {
  color: var(--text);
  background: var(--grad-soft);
  box-shadow: inset 0 0 0 1px rgba(244, 184, 68, 0.28);
}
.side-nav button.on .ic {
  color: var(--gold);
}
.side-foot {
  margin-top: auto;
  display: grid;
  gap: 2px;
}
.side-link {
  font-size: 0.88rem;
  padding: 10px 14px;
}
.nbadge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--grad);
  color: #1b0d05;
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 900;
  display: grid;
  place-items: center;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(240, 132, 42, 0.5);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(240, 132, 42, 0);
  }
}
.main {
  padding: 28px clamp(16px, 3vw, 40px) 60px;
  min-width: 0;
}
.aview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  animation: viewIn 0.4s var(--ease);
}
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.vhead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.vhead h1 {
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  margin-bottom: 4px;
}
.vactions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.filters .cats {
  min-width: 0;
  max-width: 100%;
}
.filters .chip {
  height: 36px;
  padding: 0 13px;
  font-size: 0.85rem;
}

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.kpi {
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.kpi small {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
}
.kpi small .ic {
  color: var(--gold);
}
.kpi b {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  line-height: 1.1;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}
.kpi span {
  color: var(--dim);
  font-size: 0.8rem;
  font-weight: 600;
}
.kpi.hot {
  border-color: rgba(244, 184, 68, 0.35);
  background: linear-gradient(135deg, rgba(244, 184, 68, 0.1), rgba(217, 67, 28, 0.05)), var(--surface);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: start;
}
.panel-card {
  padding: 22px;
  box-shadow: none;
}
.pc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.pc-head h3 {
  font-size: 1.25rem;
}
.chart-card {
  grid-row: span 2;
}

/* gráfico de barras */
.chart {
  position: relative;
  height: 260px;
}
.chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.chart .grid line {
  stroke: rgba(255, 226, 190, 0.08);
  stroke-width: 1;
}
.chart .axis text {
  fill: var(--dim);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
}
.chart .bar {
  fill: #e8782a;
  transition: opacity 0.15s;
}
.chart .bar.zero {
  fill: rgba(255, 226, 190, 0.1);
}
.chart.hovering .bar {
  opacity: 0.45;
}
.chart.hovering .bar.active {
  opacity: 1;
}
.chart .hit {
  fill: transparent;
  cursor: pointer;
}
.chart .peak {
  fill: var(--text);
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font);
}
.chart-tip {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(31, 25, 21, 0.97);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  white-space: nowrap;
  z-index: 2;
}
.chart-tip b {
  display: block;
  font-size: 0.95rem;
}
.chart-tip span {
  color: var(--muted);
  font-weight: 600;
}
.chart-table table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.chart-table td,
.chart-table th,
.data-table td,
.data-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.chart-table th,
.data-table th {
  color: var(--dim);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.num-cell {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

.top-list {
  display: grid;
  gap: 14px;
}
.top-row {
  display: grid;
  gap: 6px;
}
.top-row .t {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
}
.top-row .t span {
  color: var(--muted);
  font-weight: 600;
}
.top-row .t b {
  font-variant-numeric: tabular-nums;
}
.top-row .track {
  height: 8px;
  border-radius: 8px;
  background: rgba(255, 226, 190, 0.06);
  overflow: hidden;
}
.top-row .track i {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: #e8782a;
}
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.checklist li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  font-weight: 650;
  font-size: 0.9rem;
}
.checklist li .ck {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  border: 1.5px solid var(--line-2);
  color: transparent;
}
.checklist li.ok {
  color: var(--dim);
}
.checklist li.ok .ck {
  background: var(--ok);
  border-color: transparent;
  color: #08130d;
}
.checklist li .ck .ic {
  width: 14px;
  height: 14px;
}
.checklist li button {
  margin-left: auto;
  color: var(--gold);
  font-weight: 800;
  font-size: 0.82rem;
}
.mini-orders {
  display: grid;
  gap: 8px;
}

/* lista de pedidos */
.olist {
  display: grid;
  gap: 10px;
}
.orow {
  display: grid;
  grid-template-columns: 120px 1.2fr 2fr auto auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition:
    border-color 0.2s,
    transform 0.2s var(--ease);
}
.orow:hover {
  border-color: rgba(244, 184, 68, 0.35);
}
.orow.is-new {
  border-color: rgba(244, 184, 68, 0.55);
  box-shadow: var(--glow);
}
.orow .code b {
  display: block;
  font-weight: 800;
}
.orow small {
  display: block;
  color: var(--dim);
  font-weight: 650;
  font-size: 0.8rem;
}
.orow .who b {
  display: block;
  font-weight: 750;
}
.orow .what {
  color: var(--muted);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.orow .what .tags {
  display: flex;
  gap: 6px;
  margin-top: 5px;
}
.tagx {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(255, 240, 220, 0.06);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}
.tagx .ic {
  width: 13px;
  height: 13px;
}
.orow .amt {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.orow.compact {
  grid-template-columns: 1fr auto auto;
  padding: 12px 14px;
  gap: 12px;
}

/* detalle de pedido */
.drawer.wide .panel {
  width: min(620px, 100%);
}
.od-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 18px;
}
.od-block {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.od-block > h4 {
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}
.od-cust {
  display: flex;
  align-items: center;
  gap: 14px;
}
.od-cust b {
  display: block;
  font-size: 1.05rem;
}
.od-cust .btns {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 14px;
  font-size: 0.92rem;
}
.kv dt {
  color: var(--dim);
  font-weight: 700;
}
.kv dd {
  margin: 0;
  font-weight: 650;
}
.od-map {
  height: 230px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  margin-top: 14px;
}
.od-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.weigh {
  display: grid;
  grid-template-columns: 1fr 110px 110px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.weigh b {
  display: block;
  font-weight: 750;
}
.weigh small {
  color: var(--dim);
  font-weight: 600;
  font-size: 0.8rem;
}
.weigh .input {
  height: 40px;
  padding: 0 10px;
  text-align: right;
  font-weight: 750;
}
.weigh .lt {
  text-align: right;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.weigh-head {
  display: grid;
  grid-template-columns: 1fr 110px 110px;
  gap: 10px;
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.weigh-head span:not(:first-child) {
  text-align: right;
}
.inline-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}
.inline-field .input {
  width: 150px;
  height: 40px;
  text-align: right;
}

/* tabla de productos */
.ptable {
  display: grid;
  gap: 8px;
}
.prow {
  display: grid;
  grid-template-columns: 56px 1.6fr 170px 90px 56px 44px 44px;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 10px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.prow.off {
  opacity: 0.62;
}
.prow .thumb {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #2a1f19, #120d0b);
}
.prow .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.prow .thumb .art {
  width: 92%;
}
.prow .nm b {
  display: block;
  font-weight: 750;
}
.prow .nm small {
  color: var(--dim);
  font-weight: 650;
  font-size: 0.8rem;
}
.prow .nm .flags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.price-in {
  position: relative;
}
.price-in span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  font-weight: 700;
  font-size: 0.82rem;
  pointer-events: none;
}
.price-in .input {
  height: 44px;
  padding-left: 40px;
  text-align: right;
  font-weight: 800;
  font-size: 1rem;
}
.price-in .input.saved {
  border-color: rgba(76, 195, 138, 0.6);
  box-shadow: 0 0 0 4px rgba(76, 195, 138, 0.12);
}
.prow .unit {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
}
.star-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--dim);
  transition: all 0.2s;
}
.star-btn:hover {
  background: rgba(255, 240, 220, 0.05);
  color: var(--text);
}
.star-btn.on {
  color: var(--gold);
}
.star-btn.on .ic {
  fill: currentColor;
}

/* clientes */
.ctable {
  display: grid;
  gap: 8px;
}
.crow {
  display: grid;
  grid-template-columns: 46px 1.4fr 1fr 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 12px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.crow b {
  display: block;
  font-weight: 750;
}
.crow small {
  display: block;
  color: var(--dim);
  font-weight: 650;
  font-size: 0.8rem;
}
.crow .btns {
  display: flex;
  gap: 6px;
}

/* ajustes */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

/* modal: carga rápida */
.qtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.qtable td,
.qtable th {
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.qtable th {
  color: var(--dim);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.qtable .select,
.qtable .input {
  height: 38px;
  font-size: 0.85rem;
  border-radius: 10px;
}
.diff-up {
  color: #ff9a6a;
  font-weight: 800;
}
.diff-down {
  color: var(--ok);
  font-weight: 800;
}
.img-drop {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: center;
}
.img-drop .prev {
  width: 120px;
  height: 90px;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #2a1f19, #120d0b);
  border: 1px solid var(--line-2);
}
.img-drop .prev img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-drop .prev .art {
  width: 90%;
}
.hist-list {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* barra móvil */
.mnav {
  display: none;
}

/* impresión de ticket */
#printArea {
  display: none;
}
@media print {
  body.admin-body {
    background: #fff !important;
  }
  body::before,
  .shell,
  .layer,
  #toasts,
  .login {
    display: none !important;
  }
  #printArea {
    display: block !important;
    color: #000;
    font: 12px/1.4 'Courier New', monospace;
    width: 72mm;
  }
  #printArea h2 {
    font: 700 16px/1.2 'Courier New', monospace;
    text-align: center;
    margin: 0 0 4px;
  }
  #printArea .c {
    text-align: center;
  }
  #printArea hr {
    border: 0;
    border-top: 1px dashed #000;
    margin: 6px 0;
  }
  #printArea .r {
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }
  #printArea .big {
    font-size: 15px;
    font-weight: 700;
  }
  @page {
    margin: 4mm;
  }
}

@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .chart-card {
    grid-row: auto;
  }
  .orow {
    grid-template-columns: 110px 1fr auto auto;
  }
  .orow .what {
    display: none;
  }
}
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .side {
    display: none;
  }
  .main {
    padding-bottom: calc(110px + var(--safe-b));
  }
  .mnav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + var(--safe-b));
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 66px;
    border-radius: 22px;
    background: rgba(31, 25, 21, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--line-2);
    box-shadow: var(--shadow);
  }
  .mnav button {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    color: var(--dim);
    font-size: 0.68rem;
    font-weight: 800;
  }
  .mnav button .ic {
    width: 22px;
    height: 22px;
  }
  .mnav button.on {
    color: var(--gold);
  }
  .mnav .nbadge {
    position: absolute;
    top: 6px;
    left: calc(50% + 6px);
    margin: 0;
    min-width: 18px;
    height: 18px;
    font-size: 0.68rem;
    padding: 0 5px;
  }
  .prow {
    grid-template-columns: 52px 1fr 130px;
    grid-template-areas: none;
  }
  .prow .unit,
  .prow .star-btn {
    display: none;
  }
  .prow .switch {
    grid-column: 2;
  }
  .prow > :last-child {
    grid-column: 3;
    justify-self: end;
  }
  .crow {
    grid-template-columns: 42px 1fr auto;
  }
  .crow .hide-m {
    display: none;
  }
}
@media (max-width: 640px) {
  .kpis {
    gap: 10px;
  }
  .kpi {
    padding: 14px;
  }
  .kpi b {
    font-size: clamp(1.1rem, 5.4vw, 1.5rem);
    letter-spacing: -0.01em;
  }
  .orow {
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
  }
  .orow .who {
    grid-column: 1;
    grid-row: 2;
  }
  .orow .st {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }
  .weigh,
  .weigh-head {
    grid-template-columns: 1fr 90px 96px;
  }
  .kv {
    grid-template-columns: 96px 1fr;
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .od-cust {
    flex-wrap: wrap;
  }
  .od-cust .btns {
    margin-left: 0;
    width: 100%;
  }
  .od-cust .btns .btn {
    flex: 1;
  }
}
