:root {
  --red: #e51d2c;
  --ink: #17191f;
  --muted: #687084;
  --line: #e8ebf0;
  --shadow: 0 6px 18px #1b23300b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #f8f8fa;
  color: var(--ink);
  font-family: "DM Sans", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* Login */
.login-screen {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #101217;
  color: #fff;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0, #272a31, transparent 43%);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  opacity: 0.32;
  filter: blur(3px);
  animation: float 11s ease-in-out infinite;
}

.orb-one {
  width: 480px;
  height: 480px;
  top: -230px;
  left: -160px;
  background: #bb2732;
}

.orb-two {
  width: 410px;
  height: 410px;
  right: -150px;
  bottom: -220px;
  background: #565a65;
  animation-delay: -5s;
}

@keyframes float {
  50% {
    transform: translate(70px, 52px) scale(1.12);
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(11px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes komplotNavGlow {
  0%,
  100% {
    opacity: 0.55;
    transform: scaleX(0.88);
  }

  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

.login-card {
  position: relative;
  width: min(410px, calc(100% - 32px));
  padding: 36px;
  border: 1px solid #ffffff16;
  border-radius: 16px;
  background: #1b1e25e8;
  box-shadow: 0 24px 80px #0008;
  backdrop-filter: blur(12px);
  animation: reveal 0.6s both;
}

.login-logo {
  display: block;
  max-width: 175px;
  max-height: 62px;
  margin-bottom: 28px;
  object-fit: contain;
  object-position: left;
}

.login-kicker,
.eyebrow {
  margin: 0 0 7px;
  color: #ff6771;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.login-card h1 {
  margin: 0;
  font-size: 29px;
  letter-spacing: -0.8px;
}

.login-card > p {
  margin: 8px 0 25px;
  color: #adb3c1;
  font-size: 14px;
}

.login-card label {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  color: #e3e5e9;
  font-size: 13px;
  font-weight: 600;
}

.login-card input {
  padding: 12px;
  border: 1px solid #ffffff24;
  border-radius: 7px;
  outline: 0;
  background: #101218;
  color: #fff;
}

.login-card input:focus {
  border-color: #f34552;
  box-shadow: 0 0 0 3px #ef354129;
}

/* Botones */
.primary-btn,
.secondary-btn,
.danger-btn,
.file-select-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, #f03947, #d91424);
  box-shadow: 0 8px 16px #dd172530;
  transition: 0.2s;
}

.primary-btn:hover {
  background: #c91423;
  transform: translateY(-1px);
}

.secondary-btn {
  border: 1px solid #dce1e8;
  background: #fff;
  color: #404756;
}

.danger-btn {
  background: #d91a28;
  color: #fff;
}

.login-submit {
  width: 100%;
  margin-top: 12px;
}

/* Layout */
.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: 30px 15px 22px;
  color: #fff;
  background: linear-gradient(145deg, #101318, #191c22 68%, #0b0d10);
}

.brand {
  display: block;
  padding: 0 10px;
}

.brand img {
  display: block;
  max-width: 174px;
  max-height: 60px;
  object-fit: contain;
  object-position: left;
}

.side-nav {
  margin-top: 47px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 17px;
  border-left: 5px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.nav-link.active {
  border-left-color: var(--red);
  background: #282c34;
}

.nav-link span {
  color: #ff3844;
  font-size: 24px;
}

.logout-btn {
  margin-top: auto;
  padding: 23px 10px 0;
  border: 0;
  border-top: 1px solid #292d35;
  background: transparent;
  color: #fff;
  font-weight: 600;
  text-align: left;
}

.logout-btn span,
.mobile-logout span {
  margin-right: 9px;
  font-size: 22px;
}

.main-content {
  width: 100%;
  max-width: 1550px;
  margin: auto;
  padding: 30px 36px 46px;
  animation: reveal 0.55s both;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 12px 26px;
}

.topbar h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: -1.4px;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 17px;
}

/* Contadores */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 108px;
  padding: 17px 19px;
  border: 1px solid #f0f1f4;
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow);
}

.stat-card i {
  display: grid;
  width: 57px;
  height: 57px;
  place-items: center;
  border-radius: 15px;
  font-size: 29px;
  font-style: normal;
}

.total i {
  background: #ffeaec;
  color: #e51f2c;
}

.available i {
  background: #edf9ef;
  color: #41a64d;
}

.hidden-card i {
  background: #fff7e8;
  color: #f5a000;
}

.stat-card p {
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 500;
}

.stat-card strong {
  display: block;
  font-size: 26px;
  line-height: 1.05;
}

.stat-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

/* Filtros */
.filter-panel,
.products-panel {
  border: 1px solid #f0f1f4;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.filter-panel {
  margin-top: 17px;
  padding: 17px;
}

.filter-panel h2 {
  margin: 0 0 16px;
  font-size: 19px;
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-pill {
  min-height: 39px;
  padding: 0 20px;
  border: 1px solid #dfe2e8;
  border-radius: 999px;
  background: #fff;
}

.filter-pill.active {
  border-color: #15171c;
  background: #171a20;
  color: #fff;
}

/* Productos */
.products-panel {
  margin-top: 17px;
  overflow: hidden;
  transition: opacity 0.22s, transform 0.22s;
}

.products-panel.is-changing {
  opacity: 0.2;
  transform: translateY(6px);
}

.table-note {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 13px 23px 3px;
  color: #9aa1ae;
  font-size: 11px;
}

.table-note span {
  font-size: 14px;
}

.table-head,
.product-row {
  display: grid;
  grid-template-columns: 38px 92px minmax(160px, 1.35fr) minmax(100px, 0.8fr) minmax(180px, 1.45fr) minmax(135px, 0.8fr) 60px;
  gap: 16px;
  align-items: center;
}

.table-head {
  min-height: 52px;
  padding: 0 23px;
  border-bottom: 1px solid var(--line);
  color: #5e6778;
  font-size: 13px;
  font-weight: 600;
}

.product-row {
  min-height: 82px;
  padding: 9px 23px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  transition: 0.16s;
}

.product-row:hover {
  background: #fcfcfd;
}

.product-row.dragging {
  opacity: 0.3;
}

.product-row.drag-over {
  box-shadow: inset 0 3px var(--red);
}

.drag-handle,
.delete-btn,
.edit-trigger {
  border: 0;
  background: transparent;
}

.drag-handle {
  padding: 5px;
  color: #9299a6;
  font-size: 19px;
  letter-spacing: -5px;
  cursor: grab;
}

.product-photo {
  width: 58px;
  height: 58px;
  overflow: hidden;
  border-radius: 6px;
  background: #e7e9ed;
}

.product-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-name,
.product-description {
  padding: 5px 0;
  color: var(--ink);
  text-align: left;
}

.product-name {
  font-weight: 500;
}

.product-description {
  font-size: 14px;
}

.product-price {
  font-size: 14px;
}

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #667084;
  font-size: 13px;
  cursor: pointer;
}

.status input,
.visibility input {
  position: absolute;
  opacity: 0;
}

.status span,
.visibility span {
  position: relative;
  display: block;
  width: 34px;
  height: 19px;
  border-radius: 99px;
  background: #bdc4ce;
  transition: 0.2s;
}

.status span::after,
.visibility span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px #0003;
  transition: 0.2s;
}

.status input:checked + span,
.visibility input:checked + span {
  background: var(--red);
}

.status input:checked + span::after,
.visibility input:checked + span::after {
  transform: translateX(15px);
}

.status em {
  font-style: normal;
}

.delete-btn {
  justify-self: center;
  padding: 5px;
  color: #e51d2c;
  font-size: 25px;
  transform: rotate(90deg);
}

.empty-state {
  margin: 0;
  padding: 35px;
  color: var(--muted);
  text-align: center;
}

/* Modales */
.product-dialog,
.confirm-dialog {
  padding: 0;
  border: 0;
  box-shadow: 0 22px 55px #0006;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: 0.22s;
}

.product-dialog {
  width: min(590px, calc(100% - 26px));
  max-height: calc(100vh - 28px);
  overflow: visible;
  border-radius: 14px;
}

.confirm-dialog {
  width: min(410px, calc(100% - 28px));
  border-radius: 15px;
}

.product-dialog[open],
.confirm-dialog[open] {
  opacity: 1;
  transform: none;
}

.product-dialog::backdrop,
.confirm-dialog::backdrop {
  background: #12151ccc;
  backdrop-filter: blur(3px);
}

.product-dialog form {
  padding: 25px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 21px;
}

.dialog-header h2 {
  margin: 0;
  font-size: 25px;
}

.icon-btn {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #e5e7ec;
  border-radius: 50%;
  background: #f8f9fb;
  color: #666f7d;
  font-size: 24px;
  line-height: 1;
  transition: 0.2s;
}

.icon-btn:hover {
  border-color: #f0b0b6;
  background: #fff0f1;
  color: #dc1b29;
  transform: rotate(90deg);
}

/* Formulario */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.form-grid > label {
  display: grid;
  gap: 7px;
  color: #3a404b;
  font-size: 13px;
  font-weight: 600;
}

.form-grid input:not([type="checkbox"]),
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #dce0e7;
  border-radius: 7px;
  outline: 0;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: #ef2937;
  box-shadow: 0 0 0 3px #ef293720;
}

.form-grid textarea {
  resize: vertical;
}

.full-width {
  grid-column: 1 / -1;
}

.image-upload {
  padding: 14px;
  border: 1px solid #e1e4e9;
  border-radius: 10px;
  background: #fbfbfc;
}

.image-upload-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.image-upload-copy p {
  margin: 0;
  font-weight: 700;
}

.image-upload small {
  color: var(--muted);
  font-size: 11px;
}

.image-upload-content {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.image-preview {
  display: grid;
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #cfd5de;
  border-radius: 8px;
  color: #858e9d;
  font-size: 10px;
  text-align: center;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-select-btn {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid #ef3541;
  border-radius: 7px;
  background: #fff;
  color: #d71726;
  font-size: 13px;
  cursor: pointer;
}

.image-upload-actions p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.visibility-field {
  display: flex !important;
  align-items: center;
  gap: 10px !important;
  cursor: pointer;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 23px;
}

.dialog-actions button {
  min-height: 42px;
}

/* Editor de imagen */
.crop-editor {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #11151bd9;
  backdrop-filter: blur(3px);
}

.crop-card {
  width: min(520px, 100%);
  padding: 19px;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 18px 42px #0007;
  animation: reveal 0.25s both;
}

.crop-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.crop-card h3 {
  margin: 0;
  font-size: 21px;
}

.crop-card header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.crop-stage {
  height: min(385px, 49vh);
  margin: 15px 0;
  overflow: hidden;
  background: #1c2026;
}

.crop-stage img {
  display: block;
  max-width: 100%;
}

.crop-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.crop-actions > div:last-child {
  display: flex;
  gap: 8px;
}

.crop-actions button {
  min-height: 39px;
  padding: 0 13px;
  font-size: 13px;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #657083;
  font-size: 12px;
}

.zoom-controls button {
  width: 27px;
  padding: 0;
  border: 1px solid #dce1e8;
  border-radius: 5px;
  background: #fff;
  font-size: 18px;
}

/* Confirmación */
.confirm-card {
  padding: 31px;
  text-align: center;
}

.confirm-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fff0f1;
  color: #df1e2c;
  font-size: 28px;
  font-weight: 700;
}

.confirm-card h2 {
  margin: 0;
  font-size: 23px;
}

.confirm-card p {
  margin: 9px auto 23px;
  color: #687084;
  font-size: 14px;
  line-height: 1.5;
}

.mobile-logout {
  display: none;
}

/* Tablet */
@media (max-width: 1050px) {
  .main-content {
    padding: 27px 23px;
  }

  .table-head,
  .product-row {
    grid-template-columns: 30px 72px minmax(145px, 1.2fr) minmax(90px, 0.7fr) minmax(125px, 1fr) minmax(110px, 0.7fr) 45px;
    gap: 9px;
    padding-right: 15px;
    padding-left: 15px;
  }

  .product-photo {
    width: 52px;
    height: 52px;
  }
}

/* Móvil */
@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding-bottom: 90px;
  }

  .sidebar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    min-height: 72px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 14px 18px 17px;
    overflow: visible;
  }

  /* Barra de progreso con glow */
  .sidebar::after {
    content: "";
    position: absolute;
    right: 18px;
    bottom: 0;
    left: 18px;
    height: 3px;
    border-radius: 99px;
    background: linear-gradient(
      90deg,
      transparent 0%,
      #e51d2c 18%,
      #ff6670 50%,
      #e51d2c 82%,
      transparent 100%
    );
    box-shadow:
      0 0 8px #e51d2ce6,
      0 0 18px #e51d2c73;
    animation: komplotNavGlow 2.8s ease-in-out infinite;
  }

  .brand {
    padding: 0;
  }

  .brand img {
    max-width: 160px;
    max-height: 44px;
  }

  .side-nav,
  .desktop-logout {
    display: none;
  }

  .mobile-logout {
    position: fixed;
    z-index: 21;
    top: 14px;
    right: 18px;
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #ffffff1a;
    border-radius: 8px;
    background: #ffffff14;
    color: #f5f6f8;
    backdrop-filter: blur(8px);
    font-size: 12px;
    font-weight: 600;
  }

  .mobile-logout span {
    margin-right: 5px;
    font-size: 20px;
  }

  .main-content {
    padding: 25px 16px;
  }

  .topbar {
    align-items: flex-start;
    margin: 0 0 23px;
  }

  .topbar h1 {
    font-size: 31px;
  }

  .topbar p {
    max-width: 260px;
    font-size: 15px;
  }

  .add-product {
    position: fixed;
    z-index: 6;
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: calc(100% - 32px);
    min-height: 51px;
    border-radius: 11px;
    font-size: 15px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .stat-card {
    min-height: 87px;
    padding: 14px;
  }

  .stat-card i {
    width: 53px;
    height: 53px;
    font-size: 27px;
  }

  .stat-card strong {
    display: inline;
    margin-right: 7px;
  }

  .stat-card small {
    display: inline;
    font-size: 12px;
  }

  .filter-panel {
    padding: 15px;
  }

  .filter-list {
    gap: 8px;
  }

  .filter-pill {
    min-height: 37px;
    padding: 0 14px;
    font-size: 13px;
  }

  .products-panel {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .table-note {
    padding: 0 2px 10px;
    color: #9aa1ae;
    font-size: 11px;
  }

  .table-head {
    display: none;
  }

  .products-list {
    display: grid;
    gap: 10px;
  }

  .product-row {
    display: grid;
    min-height: 0;
    grid-template-columns: 22px 57px minmax(0, 1fr) 34px;
    grid-template-areas:
      "drag image name delete"
      "drag image price delete"
      "desc desc desc status";
    gap: 4px 9px;
    padding: 12px;
    border: 1px solid #eaebef;
    border-radius: 11px;
    box-shadow: var(--shadow);
  }

  .drag-handle {
    grid-area: drag;
    align-self: center;
    padding: 0;
  }

  .product-photo {
    grid-area: image;
    width: 57px;
    height: 57px;
  }

  .product-name {
    grid-area: name;
    align-self: end;
    font-size: 14px;
  }

  .product-price {
    grid-area: price;
    color: #5f6877;
    font-size: 13px;
  }

  .product-description {
    grid-area: desc;
    padding-top: 8px;
    border-top: 1px solid #eef0f3;
    color: #4d5563;
    font-size: 13px;
  }

  .status {
    grid-area: status;
    justify-self: end;
    font-size: 12px;
  }

  .delete-btn {
    grid-area: delete;
    align-self: center;
    padding: 0;
    font-size: 23px;
  }

  .product-dialog form {
    padding: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: auto;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions button {
    min-width: 0;
    padding: 0 8px;
  }

  .image-upload-copy {
    display: block;
  }

  .crop-card {
    padding: 15px;
  }

  .crop-stage {
    height: 43vh;
  }

  .crop-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .crop-actions > div:last-child {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .confirm-card {
    padding: 27px 21px;
  }
}

@media (max-width: 430px) {
  .topbar h1 {
    font-size: 28px;
  }

  .topbar p {
    max-width: 240px;
  }

  .image-upload-content {
    align-items: flex-start;
  }

  .product-dialog {
    max-height: calc(100vh - 16px);
  }
}

/* Ajustes logo y botones circulares */
@media (max-width: 760px) {
  .sidebar {
    justify-content: flex-start;
    padding-left: 20px;
  }

  .brand {
    margin: 0;
    padding: 0;
  }

  .brand img {
    max-width: 154px;
    max-height: 42px;
    object-position: left center;
  }
}

/* X del editor de producto y editor de imagen */
.product-dialog .icon-btn {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  padding: 0;
  border: 1px solid #ffd2d6;
  border-radius: 50%;
  background: #fff1f2;
  color: #df1e2c;
  font-size: 26px;
  line-height: 1;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.product-dialog .icon-btn:hover {
  background: #e51d2c;
  color: #fff;
  box-shadow: 0 7px 16px rgba(229, 29, 44, 0.25);
  transform: rotate(90deg) scale(1.05);
}

/* Botón eliminar en cada producto */
.delete-btn {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  justify-self: center;
  padding: 0;
  border: 1px solid #ffd2d6;
  border-radius: 50%;
  background: #fff1f2;
  color: #df1e2c;
  font-size: 0;
  transform: none;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.delete-btn::before {
  content: "×";
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
}

.delete-btn:hover {
  background: #e51d2c;
  color: #fff;
  box-shadow: 0 7px 16px rgba(229, 29, 44, 0.25);
  transform: scale(1.06);
}

@media (max-width: 760px) {
  .delete-btn {
    width: 34px;
    height: 34px;
  }
}

/* CORRECCIÓN DEFINITIVA DEL EDITOR DE PRODUCTOS */

/* Estructura del modal */
.product-dialog {
  width: min(620px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.product-dialog form {
  padding: 28px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.dialog-header > div {
  min-width: 0;
}

.dialog-header h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

/* X del editor y del recortador */
.close-icon {
  display: grid;
  width: 38px;
  height: 38px;
  min-width: 38px;
  flex: 0 0 38px;
  place-items: center;
  align-self: flex-start;
  padding: 0;
  border: 1px solid #ffd2d6;
  border-radius: 50%;
  background: #fff1f2;
  color: #df1e2c;
  font-size: 26px;
  line-height: 1;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.close-icon:hover {
  background: #e51d2c;
  color: #fff;
  box-shadow: 0 7px 16px rgba(229, 29, 44, 0.26);
  transform: rotate(90deg) scale(1.05);
}

/* Grilla ordenada */
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.form-grid > label {
  display: grid;
  align-content: start;
  gap: 7px;
  margin: 0;
}

.form-grid > label input,
.form-grid > label select,
.form-grid > label textarea {
  align-self: start;
  min-height: 46px;
}

/* Esta clase existe en tu HTML y faltaba en tu CSS */
.form-span {
  grid-column: 1 / -1;
}

/* Imagen: ahora ocupa su fila completa */
.image-upload {
  grid-column: 1 / -1;
  padding: 16px;
}

.image-upload-content {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 13px;
}

.image-upload-content > div:last-child {
  min-width: 0;
}

.image-upload-content p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Descripción */
#descriptionInput {
  min-height: 88px;
}

/* Estado visible */
.visibility {
  display: flex !important;
  align-items: center;
  gap: 10px !important;
  min-height: 42px;
  color: #4a5260;
  cursor: pointer;
}

.visibility input {
  position: absolute;
  opacity: 0;
}

.visibility span {
  position: relative;
  display: block;
  width: 38px;
  height: 21px;
  flex: 0 0 auto;
  border-radius: 99px;
  background: #bdc4ce;
  transition: background 0.2s ease;
}

.visibility span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.visibility input:checked + span {
  background: var(--red);
}

.visibility input:checked + span::after {
  transform: translateX(17px);
}

/* Botones inferiores */
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}

.dialog-actions .secondary-btn,
.dialog-actions .primary-btn {
  min-width: 116px;
  min-height: 43px;
}

/* Editor Cropper */
.crop-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #657083;
  font-size: 12px;
}

.zoom button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid #dce1e8;
  border-radius: 6px;
  background: #fff;
  font-size: 18px;
}

/* Eliminar producto: círculo rojo, no ícono largo */
.delete-btn {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  justify-self: center;
  padding: 0;
  border: 1px solid #ffd2d6;
  border-radius: 50%;
  background: #fff1f2;
  color: #df1e2c;
  font-size: 0;
  transform: none;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.delete-btn::before {
  content: "×";
  font-size: 27px;
  font-weight: 500;
  line-height: 1;
}

.delete-btn:hover {
  background: #e51d2c;
  color: #fff;
  box-shadow: 0 7px 16px rgba(229, 29, 44, 0.25);
  transform: scale(1.06);
}

/* Móvil */
@media (max-width: 760px) {
  .product-dialog {
    width: min(100% - 20px, 560px);
    max-height: calc(100vh - 20px);
  }

  .product-dialog form {
    padding: 20px;
  }

  .dialog-header {
    margin-bottom: 20px;
  }

  .dialog-header h2 {
    font-size: 23px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-span,
  .image-upload {
    grid-column: auto;
  }

  .image-upload-content {
    align-items: flex-start;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .dialog-actions .secondary-btn,
  .dialog-actions .primary-btn {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
  }

  .delete-btn {
    width: 34px;
    height: 34px;
  }
}

/* Footer del editor: switch alineado con botones */
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.footer-visibility {
  margin: 0;
  white-space: nowrap;
}

.dialog-button-group {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Entrada escalonada de productos filtrados */
.product-row.cascade-enter {
  opacity: 0;
  transform: translateY(14px) scale(0.985);
}

.product-row.cascade-enter.cascade-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.36s ease,
    transform 0.36s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Mantiene siempre fijo el inicio del panel al filtrar */
.main-content {
  min-height: 100vh;
  margin: 0 auto;
  align-self: start;
}

/* Corrige el contexto del botón flotante en móvil */
@media screen and (max-width: 760px) {
  .main-content {
    animation: none !important;
    transform: none !important;
  }

  #addProductBtn {
    position: fixed !important;
    z-index: 9999 !important;
    top: auto !important;
    right: 16px !important;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    left: 16px !important;

    display: flex !important;
    width: auto !important;
    min-height: 54px !important;
    align-items: center;
    justify-content: center;

    border-radius: 13px !important;
    box-shadow:
      0 14px 32px rgba(229, 29, 44, 0.36),
      0 4px 10px rgba(0, 0, 0, 0.16);
  }
}

/* Editor de producto compacto en móvil */
@media (max-width: 760px) {
  .product-dialog {
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 16px;
  }

  .product-dialog form {
    padding: 18px 18px 16px;
  }

  /* Oculta solo la X superior del editor de producto */
  .product-dialog form .close-icon {
    display: none;
  }

  .dialog-header {
    display: block;
    margin-bottom: 14px;
  }

  .dialog-header h2 {
    font-size: 21px;
    line-height: 1.1;
    letter-spacing: -0.4px;
  }

  .form-grid {
    gap: 10px;
  }

  .form-grid > label {
    gap: 4px;
    font-size: 12px;
  }

  .form-grid > label input,
  .form-grid > label select {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 14px;
  }

  .image-upload {
    padding: 12px;
  }

  .image-upload b {
    font-size: 14px;
  }

  .image-upload small {
    font-size: 10px;
  }

  .image-upload-content {
    gap: 12px;
    margin-top: 9px;
  }

  .image-preview {
    width: 64px;
    height: 64px;
  }

  .file-select-btn {
    min-height: 36px;
    padding: 0 11px;
    font-size: 12px;
  }

  .image-upload-content p {
    margin-top: 4px;
    font-size: 10px;
  }

  #descriptionInput {
    min-height: 68px;
    padding: 9px 10px;
    font-size: 14px;
  }

  .footer-visibility {
    min-height: 32px;
    font-size: 13px;
  }

  .footer-visibility span {
    width: 34px;
    height: 19px;
  }

  .footer-visibility span::after {
    width: 13px;
    height: 13px;
  }

  .footer-visibility input:checked + span::after {
    transform: translateX(15px);
  }

  .dialog-actions {
    gap: 10px;
    margin-top: 14px;
  }

  .dialog-actions .secondary-btn,
  .dialog-actions .primary-btn {
    min-height: 42px;
    font-size: 14px;
  }
}

/* Animación suave para modales */
.product-dialog[open],
.confirm-dialog[open] {
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition:
    opacity 0.24s ease,
    transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.product-dialog[open].visible,
.confirm-dialog[open].visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Editor de recorte */
.crop-editor {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
  transition:
    opacity 0.22s ease,
    transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.crop-editor.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Confirmaciones Komplot: textura roja suave, sin iconos */
.confirm-card {
  position: relative;
  overflow: hidden;
  padding: 42px 28px 28px;
  border-radius: 15px;
  background:
    radial-gradient(
      ellipse 130% 75% at 50% -28%,
      rgba(229, 29, 44, 0.24) 0%,
      rgba(244, 89, 99, 0.11) 32%,
      rgba(255, 255, 255, 0) 72%
    ),
    linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
}

/* Línea sutil superior */
.confirm-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 18%;
  left: 18%;
  height: 2px;
  border-radius: 0 0 99px 99px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(229, 29, 44, 0.8),
    transparent
  );
  box-shadow: 0 2px 12px rgba(229, 29, 44, 0.32);
}

/* Oculta los iconos de eliminar y pregunta */
.confirm-symbol {
  display: none;
}

.confirm-card h2,
.confirm-card p,
.confirm-actions {
  position: relative;
  z-index: 1;
}

.confirm-card h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.18;
  letter-spacing: -0.5px;
}

.confirm-card p {
  max-width: 300px;
  margin: 12px auto 26px;
  color: #687084;
  font-size: 14px;
  line-height: 1.55;
}

/* Móvil */
@media (max-width: 760px) {
  .confirm-card {
    padding: 38px 23px 23px;
  }

  .confirm-card h2 {
    font-size: 21px;
  }

  .confirm-card p {
    margin-bottom: 22px;
    font-size: 13px;
  }

  .confirm-actions {
    gap: 9px;
  }
}

/* Evita salto horizontal al abrir un popup */
html {
  scrollbar-gutter: stable;
}

/* Transición más suave de las cards modales */
.product-dialog,
.confirm-dialog {
  will-change: opacity, transform;
  transition:
    opacity 0.26s ease,
    transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1),
    overlay 0.26s allow-discrete,
    display 0.26s allow-discrete;
}

/* Evita el borde azul de foco del navegador */
.product-dialog:focus,
.confirm-dialog:focus {
  outline: none;
}

/* Backdrop inicialmente transparente */
.product-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(11, 14, 20, 0);
  opacity: 0;
  backdrop-filter: blur(0);
  transition:
    background 0.26s ease,
    opacity 0.26s ease,
    backdrop-filter 0.26s ease;
}

/* Backdrop aparece suavemente */
.product-dialog.visible::backdrop,
.confirm-dialog.visible::backdrop {
  background: rgba(11, 14, 20, 0.78);
  opacity: 1;
  backdrop-filter: blur(3px);
}

/* Entrada inicial sin salto */
@starting-style {
  .product-dialog[open].visible,
  .confirm-dialog[open].visible {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
}

/* Mobile: evita el rebote blanco al llegar arriba */
@media (max-width: 760px) {
  html {
    background: #101217;
    overscroll-behavior-y: auto;
  }

  body {
    min-height: 100dvh;
    overscroll-behavior-y: auto;
  }

  /* Barra real de progreso: izquierda → derecha */
  .sidebar {
    --scroll-progress: 0%;
  }

  .sidebar::after {
    right: auto;
    bottom: 0;
    left: 0;

    width: var(--scroll-progress);
    height: 3px;

    border-radius: 0 99px 99px 0;
    background: linear-gradient(
      90deg,
      #e51d2c 0%,
      #ff6670 70%,
      #ffd0d4 100%
    );

    box-shadow:
      0 0 8px rgba(229, 29, 44, 0.92),
      0 0 20px rgba(229, 29, 44, 0.45);

    animation: none;
    transform: none;
    transition: width 0.12s linear;
  }
}

/* Transición desde login al panel */
.login-screen {
  opacity: 1;
  transition:
    opacity 0.35s ease,
    transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.login-screen.is-leaving {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.015);
}

.app-shell {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.45s ease,
    transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.app-shell.is-visible {
  opacity: 1;
  transform: translateY(0);
}


/* Confirmaciones: botones en la misma fila y con separación real */
#confirmDialog .confirm-card .confirm-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-items: center !important;
  gap: 16px !important;
  width: 100% !important;
  margin-top: 26px !important;
}

#confirmDialog .confirm-card .confirm-actions > button {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 46px !important;
  margin: 0 !important;
}

/* Móvil: botón dentro de la barra y rebote con fondo uniforme */
@media (max-width: 760px) {
  :root {
    --mobile-navbar-bg: #101318;
  }

  /*
    El fondo visible al estirar arriba.
    Body mantiene el gris claro normal del panel.
  */
  html {
    background: var(--mobile-navbar-bg);
  }

  body {
    background: #f8f8fa;
  }

  .sidebar {
    background: var(--mobile-navbar-bg);
  }

  #appShell,
  #appShell.is-visible {
    transform: none !important;
  }

  .mobile-logout {
    position: absolute !important;
    top: 50% !important;
    right: 18px !important;
    z-index: 21 !important;
    transform: translateY(-50%) !important;
  }
}

/* Móvil: footer compacto y botones siempre dentro del modal */
@media (max-width: 760px) {
  .product-dialog,
  .product-dialog form {
    overflow-x: hidden;
  }

  .product-dialog .dialog-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
    margin-top: 14px !important;
  }

  /* Switch en una fila propia, más discreta */
  .product-dialog .dialog-actions > .visibility {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
  }

  .product-dialog .dialog-actions > .visibility em {
    overflow: hidden;
    color: #687084;
    font-size: 12px !important;
    font-style: normal;
    text-overflow: ellipsis;
  }

  /* Cancelar y Guardar: misma fila, mismo ancho y márgenes correctos */
  .product-dialog .dialog-button-group {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .product-dialog .dialog-button-group button {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 42px !important;
    padding: 0 8px !important;
    align-items: center;
    justify-content: center;
    font-size: 14px !important;
  }
}

/* Tema oscuro azulado para la superficie del panel */
:root {
  --panel-bg: #111722;
  --panel-bg-soft: #151d2a;
  --panel-title: #f7f9fc;
  --panel-text: #aeb9c9;
  --card-text: #17191f;
  --card-muted: #687084;
}

/* Fondo general del panel */
body,
.app-shell,
.main-content {
  background: var(--panel-bg);
}

/* Sutil profundidad, sin recargar */
.main-content {
  background:
    radial-gradient(
      ellipse 80% 45% at 55% -15%,
      rgba(66, 87, 120, 0.18),
      transparent 70%
    ),
    var(--panel-bg);
}

/* Cabecera sobre fondo oscuro */
.topbar h1 {
  color: var(--panel-title);
}

.topbar p {
  color: var(--panel-text);
}

/* Las superficies de trabajo permanecen blancas */
.stat-card,
.filter-panel,
.products-panel,
.product-row,
.empty-state {
  border-color: rgba(255, 255, 255, 0.08);
  background: #ffffff;
}

/* Tipografía dentro de cajas blancas */
.stat-card p,
.filter-panel h2,
.products-panel,
.product-row,
.product-name,
.product-description,
.product-price {
  color: var(--card-text);
}

.stat-card small,
.table-head,
.table-note,
.status em,
.empty-state {
  color: var(--card-muted);
}

/* Línea de separación más delicada dentro del listado */
.product-row {
  border-bottom-color: #eef0f4;
}

/* Móvil: mantiene el mismo lenguaje visual */
@media (max-width: 760px) {
  body {
    background: var(--panel-bg);
  }

  .main-content {
    background:
      radial-gradient(
        ellipse 110% 35% at 50% -10%,
        rgba(66, 87, 120, 0.16),
        transparent 70%
      ),
      var(--panel-bg);
  }
}

/* Móvil: nota de orden centrada */
@media (max-width: 760px) {
  .table-note {
    display: flex;
    justify-content: center;
    width: 100%;
    padding-right: 0;
    padding-left: 0;
    text-align: center;
  }
}

/* Arrastre táctil de productos: espacio real de inserción */
@media (max-width: 760px) {
  .drag-handle {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .product-row {
    position: relative;
    transition:
      opacity 0.18s ease,
      transform 0.18s ease,
      margin-top 0.18s ease;
  }

  /* Producto que se está sosteniendo */
  .product-row.touch-dragging {
    opacity: 0.38;
    transform: scale(0.985);
  }

  /*
    El producto de destino baja suavemente:
    aparece un espacio real y una guía fina.
  */
  .product-row.drag-over {
    margin-top: 14px;
    outline: none !important;
    box-shadow: none !important;
  }

  .product-row.drag-over::before {
    content: "";
    position: absolute;
    top: -8px;
    right: 20px;
    left: 20px;
    height: 2px;
    border-radius: 99px;
    background: #f03947;
    box-shadow: 0 0 8px rgba(229, 29, 44, 0.4);
  }
}

/* Estado permanente de guardado */
.topbar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #aeb9c9;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.save-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #63d48d;
  box-shadow: 0 0 8px rgba(99, 212, 141, 0.55);
}

.save-status[data-save-state="saving"] .save-status-dot {
  background: #ffd166;
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.55);
  animation: saveStatusPulse 0.8s ease-in-out infinite alternate;
}

.save-status[data-save-state="error"] {
  color: #ffadb4;
  cursor: pointer;
}

.save-status[data-save-state="error"] .save-status-dot {
  background: #ff5360;
  box-shadow: 0 0 8px rgba(255, 83, 96, 0.6);
}

@keyframes saveStatusPulse {
  to {
    opacity: 0.35;
    transform: scale(0.75);
  }
}

.mobile-save-status {
  display: none;
}

@media (max-width: 760px) {
  .topbar-actions {
    display: contents;
  }

  .desktop-save-status {
    display: none;
  }

  .sidebar {
    min-height: 82px;
  }

  .mobile-save-status {
    position: absolute;
    bottom: 7px;
    left: 20px;
    z-index: 22;
    display: inline-flex;
    color: rgba(255, 255, 255, 0.62);
    font-size: 10px;
  }

  .mobile-save-status .save-status-dot {
    width: 5px;
    height: 5px;
  }
}

/* =========================================================
   GESTOR DE CATEGORÍAS
========================================================= */

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.filter-panel-header h2 {
  margin: 0;
}

.filter-list {
  margin-top: 16px;
}

.category-manage-btn {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #e2e5eb;
  border-radius: 9px;
  background: #fff;
  color: #404756;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.category-manage-btn:hover {
  border-color: #e51d2c;
  color: #d91a29;
  background: #fff7f7;
}

.category-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: #17191f;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  will-change: opacity, transform;
  transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.category-dialog[open].visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.category-dialog::backdrop {
  background: rgba(11, 14, 20, 0);
  opacity: 0;
  backdrop-filter: blur(3px);
  transition: background 0.24s ease, opacity 0.24s ease;
}

.category-dialog.visible::backdrop {
  background: rgba(11, 14, 20, 0.78);
  opacity: 1;
}

.category-dialog:focus {
  outline: none;
}

.category-card {
  padding: 26px;
}

.category-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.category-card-header p {
  margin: 0 0 6px;
  color: #e51d2c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.category-card-header h2 {
  margin: 0;
  color: #17191f;
  font-size: 24px;
  line-height: 1.1;
}

.category-card-header span {
  display: block;
  margin-top: 7px;
  color: #687084;
  font-size: 13px;
  line-height: 1.45;
}

.category-card .close-icon {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid #ffd5d9;
  border-radius: 50%;
  background: #fff5f6;
  color: #e51d2c;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.category-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #edf0f4;
  border-radius: 13px;
  background: #fafbfc;
}

.category-form label {
  display: grid;
  gap: 7px;
  color: #404756;
  font-size: 12px;
  font-weight: 700;
}

.category-form input {
  width: 100%;
  min-height: 43px;
  padding: 0 12px;
  border: 1px solid #dfe3ea;
  border-radius: 9px;
  background: #fff;
  color: #17191f;
  font: inherit;
}

.category-form input:focus {
  border-color: #e51d2c;
  outline: 3px solid rgba(229, 29, 44, 0.1);
}

.category-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-form-actions button {
  min-height: 39px;
}

.category-form-message {
  min-height: 17px;
  margin: 0;
  color: #d91a29;
  font-size: 12px;
  font-weight: 600;
}

.category-list {
  display: grid;
  gap: 9px;
  max-height: 292px;
  margin-top: 18px;
  overflow: auto;
  padding-right: 2px;
}

.category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 11px 12px 11px 15px;
  border: 1px solid #edf0f4;
  border-radius: 12px;
  background: #fff;
}

.category-row-details {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.category-row-details strong {
  overflow: hidden;
  color: #20232a;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-row-details span {
  color: #7a8394;
  font-size: 12px;
}

.category-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-edit-btn,
.category-delete-btn {
  min-height: 32px;
  border: 1px solid #e1e5ec;
  background: #fff;
  color: #4b5361;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.category-edit-btn {
  padding: 0 10px;
  border-radius: 8px;
}

.category-delete-btn {
  display: grid;
  width: 32px;
  place-items: center;
  padding: 0;
  border-color: #ffd8dc;
  border-radius: 50%;
  color: #e51d2c;
  font-size: 20px;
}

.category-edit-btn:hover {
  border-color: #17191f;
  color: #17191f;
}

.category-delete-btn:hover {
  border-color: #e51d2c;
  background: #fff4f5;
}

.category-locked {
  color: #8a93a3;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .filter-panel-header {
    align-items: flex-start;
  }

  .category-manage-btn {
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }

  .category-dialog {
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
  }

  .category-card {
    padding: 19px;
  }

  .category-card-header {
    margin-bottom: 16px;
  }

  .category-card-header h2 {
    font-size: 20px;
  }

  .category-card-header span {
    font-size: 12px;
  }

  .category-card .close-icon {
    display: grid;
  }

  .category-row {
    min-height: 59px;
    padding: 10px 11px 10px 13px;
  }

  .category-edit-btn {
    padding: 0 8px;
  }
}

/* Resumen en móvil: tres tarjetas cuadradas */
@media (max-width: 760px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    aspect-ratio: 1 / 1;
    min-height: 0;
    padding: 10px 7px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-align: center;
  }

  .stat-card i {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 11px;
    font-size: 20px;
  }

  .stat-card > div {
    display: grid;
    gap: 1px;
    text-align: center;
  }

  .stat-card p {
    min-height: 28px;
    margin: 0;
    font-size: 11px;
    line-height: 1.15;
  }

  .stat-card strong {
    font-size: 28px;
    line-height: 1;
  }

  .stat-card small {
    display: none;
  }
}

/* =========================================================
   BLINDAJE DE CONTENIDO — TEXTOS, PRECIOS Y EDITOR
========================================================= */

/* Nada dentro de una fila puede ensanchar el layout */
.product-row,
.product-row > *,
.product-name,
.product-price,
.product-description,
.status {
  min-width: 0;
}

/* Nombre: máximo dos líneas, incluso con palabras largas */
.product-name {
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Precio: una sola línea y nunca rompe la tabla */
.product-price {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Descripción: máximo dos líneas y sin desbordes */
.product-description {
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* El editor siempre queda contenido y puede hacer scroll vertical */
.product-dialog {
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
}

.product-dialog form,
.product-dialog .form-grid,
.product-dialog .form-grid > label,
.product-dialog input,
.product-dialog select,
.product-dialog textarea {
  min-width: 0;
  max-width: 100%;
}

.product-dialog input,
.product-dialog textarea {
  box-sizing: border-box;
}

.product-dialog textarea {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }

  .products-panel,
  .products-list,
  .product-row {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  .product-name {
    max-width: 100%;
  }

  .product-description {
    max-width: 100%;
  }

  .status {
    max-width: 118px;
    overflow: hidden;
  }

  .product-dialog,
  .product-dialog[open] {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
    margin: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .product-dialog form {
    width: 100%;
    max-height: none;
    padding: 18px !important;
  }
}

.password-field {
  position: relative;
  display: block;
}

.login-card .password-field input {
  width: 100%;
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  place-items: center;
  transform: translateY(-50%);
  background: transparent;
  color: #adb3c1;
  font-size: 16px;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: #fff;
  background: #ffffff12;
  outline: none;
}

/* Navbar fija del panel en móvil */
@media (max-width: 760px) {
  #appShell .sidebar {
    position: fixed !important;
    top: 0;
    right: 0;
    left: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-height: 82px;
    height: 82px;
    padding: 10px 16px 18px;
    box-sizing: border-box;
  }

  #appShell .main-content {
    padding-top: 107px !important;
  }

  #appShell .mobile-logout {
    position: absolute !important;
    top: 10px !important;
    right: 16px !important;
    z-index: 42 !important;
    min-height: 38px;
    transform: none !important;
  }

  #appShell .mobile-save-status {
    bottom: 6px;
    left: 16px;
  }

  #appShell .brand {
    max-width: calc(100vw - 145px);
  }

  #appShell .brand img {
    max-width: 160px;
    max-height: 40px;
  }
}
