:root {
  --ink: #22312a;
  --muted: #65736c;
  --line: #dfe6df;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --brand: #6f8f3d;
  --brand-dark: #526f2d;
  --accent: #c1842f;
  --danger: #a64242;
  --shadow: 0 12px 34px rgba(34, 49, 42, .12);
}

/* Visibilidad definitiva del boton Sobre nosotros en el login. */
body.login-mode .session-actions {
  display: flex !important;
}

body.login-mode .about-login {
  display: inline-flex !important;
}

body:not(.login-mode) .about-login,
body.login-mode #menuToggle,
body.login-mode #logoutBtn {
  display: none !important;
}

/* Correccion final: quitar el margen lateral extra del formulario en movil. */
@media (max-width: 900px) {
  #loginView #loginForm.auth-panel,
  #loginView .login-order-card {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* En movil, las imagenes y los dos cards inferiores comparten el mismo ancho. */
@media (max-width: 900px) {
  #loginView .login-hero,
  #loginView .login-actions {
    width: min(1720px, calc(100vw - 54px)) !important;
  }

  #loginView #loginForm.auth-panel,
  #loginView .login-order-card {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Ambos cards del login conservan el mismo aire interior. */
#loginView #loginForm.auth-panel,
#loginView .login-order-card {
  padding: clamp(34px, 3.4vw, 58px) !important;
}

@media (max-width: 900px) {
  #loginView #loginForm.auth-panel,
  #loginView .login-order-card {
    padding: 34px 28px 36px !important;
  }
}

@media (max-width: 560px) {
  body.login-mode .topbar {
    gap: 10px !important;
    padding: 0 16px !important;
  }

  body.login-mode .brand {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    gap: 9px !important;
  }

  body.login-mode .brand img {
    width: 32px !important;
    height: 32px !important;
    flex: 0 0 auto !important;
  }

  body.login-mode .brand-copy {
    min-width: 0 !important;
  }

  body.login-mode .brand-copy > span {
    font-size: 20px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.login-mode .brand small {
    font-size: 12px !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.login-mode .about-login {
    flex: 0 0 auto !important;
    min-height: 34px !important;
    max-width: 112px !important;
    padding: 0 14px !important;
    font-size: 14px !important;
    line-height: 1.05 !important;
  }
}

body.booting main {
  visibility: hidden;
}

.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 248, 225, .9), rgba(243, 223, 184, .88) 38%, rgba(218, 184, 126, .78) 100%),
    #f7ead2;
  color: #7a4522;
  font-size: 18px;
  letter-spacing: 0;
}

.boot-loader strong {
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .75);
}

.loading-egg {
  width: 74px;
  height: 94px;
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, .92) 0 12%, transparent 13%),
    linear-gradient(145deg, #fff1c9 0%, #d29455 52%, #9f5b2e 100%);
  box-shadow:
    inset -10px -14px 18px rgba(111, 62, 27, .28),
    inset 9px 10px 16px rgba(255, 250, 232, .75),
    0 14px 28px rgba(95, 55, 26, .26);
  transform-origin: 50% 58%;
  animation: eggSpin 1.05s linear infinite;
}

@keyframes eggSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(.96); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Visibilidad definitiva del boton Sobre nosotros en el login. */
body.login-mode .session-actions {
  display: flex !important;
}

body.login-mode .about-login {
  display: inline-flex !important;
}

body:not(.login-mode) .about-login,
body.login-mode #menuToggle,
body.login-mode #logoutBtn {
  display: none !important;
}

/* Ajuste final de login: controles reales, no imagenes deformadas. */
#loginView .gallery-button,
#loginView .gallery-button:hover {
  display: inline-flex !important;
  width: auto !important;
  min-width: 178px !important;
  min-height: 46px !important;
  padding: 0 18px !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 11px !important;
  background: linear-gradient(135deg, #b66b3f, #8a441f) !important;
  color: #fff !important;
  box-shadow: 0 4px 0 #5d2e15, 0 8px 16px rgba(81, 42, 18, .2) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.25) !important;
}

#loginView .gallery-button::before {
  display: inline-flex !important;
  content: "\1FAB6" !important;
  width: auto !important;
  height: auto !important;
  margin-right: 8px !important;
  background: none !important;
  font-size: 20px !important;
}

#loginView #loginForm .primary,
#loginView #loginForm .primary:hover {
  display: inline-flex !important;
  width: auto !important;
  min-width: 112px !important;
  min-height: 44px !important;
  padding: 0 18px !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 11px !important;
  background: linear-gradient(135deg, #4c8247, #2f6233) !important;
  color: #fff !important;
  box-shadow: 0 4px 0 #214724, 0 8px 16px rgba(35, 76, 38, .18) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.24) !important;
}

#loginView .login-order-card .primary,
#loginView .login-order-card .primary:hover {
  display: inline-flex !important;
  width: 100% !important;
  min-height: 48px !important;
  padding: 0 18px !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 11px !important;
  background: linear-gradient(135deg, #4c8247, #2f6233) !important;
  color: #fff !important;
  box-shadow: 0 4px 0 #214724, 0 8px 16px rgba(35, 76, 38, .18) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.24) !important;
}

#loginView .login-order-card .primary::before {
  display: inline-flex !important;
  content: "\1F4AC" !important;
  width: auto !important;
  height: auto !important;
  margin-right: 8px !important;
  background: none !important;
  font-size: 18px !important;
}

#loginView .login-order-card .primary::after {
  display: inline-flex !important;
  content: "\1FAB6" !important;
  width: auto !important;
  height: auto !important;
  margin-left: 8px !important;
  background: none !important;
  font-size: 18px !important;
}

#loginView .remember-login {
  position: relative !important;
  display: inline-flex !important;
  width: fit-content !important;
  min-height: 42px !important;
  align-items: center !important;
  gap: 9px !important;
  padding: 0 !important;
  background: transparent !important;
  color: #5a2e17 !important;
  font-weight: 900 !important;
}

#loginView .remember-login::before {
  display: block !important;
  content: "" !important;
  flex: 0 0 46px !important;
  width: 46px !important;
  height: 42px !important;
  border-radius: 50% !important;
  background:
    radial-gradient(ellipse at 50% 43%, #fff8e7 0 10px, #e3bd7d 10.5px 14px, transparent 14.5px),
    repeating-conic-gradient(from 18deg at 50% 58%, #6f3a14 0 8deg, #d39344 8deg 15deg, #8d541f 15deg 22deg, #f0bc6a 22deg 28deg),
    radial-gradient(ellipse at 50% 61%, #8d541f 0 18px, #5f2f10 19px 23px, transparent 24px) !important;
  box-shadow:
    inset 0 -5px 0 rgba(74, 34, 10, .18),
    0 2px 4px rgba(77, 38, 12, .24) !important;
  transform: rotate(-4deg) !important;
}

#loginView .remember-login::before {
  flex-basis: 48px !important;
  width: 48px !important;
  height: 48px !important;
  background: url("../public/login/objetos/nido-real.png") center / contain no-repeat !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  filter: drop-shadow(0 2px 3px rgba(77, 38, 12, .18)) !important;
}

#loginView .remember-login::after {
  content: "" !important;
  position: absolute !important;
  left: 14px !important;
  top: 11px !important;
  width: 14px !important;
  height: 8px !important;
  border-left: 4px solid #5a2e17 !important;
  border-bottom: 4px solid #5a2e17 !important;
  transform: rotate(-45deg) !important;
  opacity: 0 !important;
}

#loginView .remember-login::after {
  left: 17px !important;
  top: 17px !important;
  width: 13px !important;
  height: 7px !important;
  border-left: 4px solid #5a2e17 !important;
  border-bottom: 4px solid #5a2e17 !important;
}

#loginView .remember-login:has(input:checked)::after {
  opacity: 1 !important;
}

#loginView .remember-login input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#loginView .remember-login span {
  visibility: visible !important;
  min-width: 0 !important;
}

.about-login {
  min-height: 38px;
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 246, 227, .96);
  color: #6b3d1e;
  font-weight: 900;
  border: 1px solid rgba(117, 68, 32, .28);
  box-shadow: 0 3px 10px rgba(55, 30, 12, .16);
}

.about-login::before {
  content: none;
}

.about-modal {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(47, 28, 13, .58);
}

.about-card {
  position: relative;
  width: min(680px, 100%);
  padding: 30px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 90% 12%, rgba(194, 125, 58, .12), transparent 26%),
    #fff8ec;
  color: #44230f;
  box-shadow: 0 24px 60px rgba(34, 18, 7, .35);
  border: 1px solid rgba(123, 75, 32, .22);
}

.about-card h2 {
  margin: 0 0 12px;
  color: #8d5030;
  font-size: 28px;
}

.about-card p {
  margin: 0 0 12px;
  line-height: 1.5;
  font-size: 16px;
}

.about-close {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  background: #3d6b3d;
  color: #fff;
  font-weight: 900;
}

.about-gallery-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 0 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #b66b3f, #8a441f);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 4px 0 #5d2e15, 0 8px 16px rgba(81, 42, 18, .18);
}

body.login-mode .session-actions {
  display: flex !important;
}

body.login-mode #menuToggle,
body.login-mode #logoutBtn {
  display: none !important;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
button, input, select {
  font: inherit;
}
button {
  border: 0;
  cursor: pointer;
}
.hidden { display: none !important; }
body.modal-open {
  overflow: hidden;
}

.report-total-row td {
  background: #fff3d5 !important;
  color: #3a220f !important;
  font-weight: 900;
  border-top: 2px solid #c1842f !important;
}

.login-footer {
  width: 100%;
  padding: 4px 16px 18px;
  color: #74421f;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .7);
}
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
}
.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.brand-copy > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-copy small {
  display: none;
}
.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}
.session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.menu-toggle {
  width: 44px;
  height: 40px;
  border-radius: 6px;
  background: #eef3e8;
  padding: 9px 10px;
  display: grid;
  gap: 4px;
  align-content: center;
}
.menu-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}
.ghost, .primary {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
}
.ghost {
  background: #eef3e8;
  color: var(--ink);
}
.primary {
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}
.primary:hover { background: var(--brand-dark); }
main { min-height: calc(100vh - 72px); }
.login-grid {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
  gap: 28px;
  align-items: center;
  padding: 34px;
  background:
    linear-gradient(rgba(251,250,246,.86), rgba(251,250,246,.92)),
    url("../public/logoLaPo.png") center left 8% / 280px no-repeat;
}
.welcome {
  max-width: 620px;
}
.welcome img {
  width: 140px;
  height: 140px;
  object-fit: contain;
}
.welcome h1 {
  margin: 10px 0;
  font-size: 42px;
  letter-spacing: 0;
}
.welcome p {
  color: var(--muted);
  font-size: 18px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.auth-panel {
  padding: 22px;
  display: grid;
  gap: 16px;
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #eef3e8;
  border-radius: 6px;
  padding: 4px;
}
.segmented button {
  min-height: 36px;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}
.segmented button.active {
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
input, select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}
.error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}
.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}
.menu-backdrop {
  display: none;
}
.sidebar {
  min-height: calc(100vh - 72px);
  padding: 18px 12px;
  background: #eef3e8;
  border-right: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 8px;
}
.tab {
  min-height: 44px;
  border-radius: 6px;
  text-align: left;
  padding: 0 12px;
  background: transparent;
  color: var(--ink);
}
.tab.active {
  background: #fff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(34,49,42,.08);
}
.content {
  padding: 22px;
  min-width: 0;
}
.tab-page { display: none; }
.tab-page.active {
  display: grid;
  gap: 18px;
}
h2, h3 {
  margin: 0;
  letter-spacing: 0;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.metric-action {
  cursor: pointer;
}
.metric-action:hover {
  border-color: var(--brand);
  box-shadow: 0 6px 20px rgba(34, 49, 42, .1);
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.list-search {
  margin-top: 6px;
}
.list-search input {
  max-width: 420px;
}
.filters {
  display: flex;
  gap: 8px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.form-grid .primary,
.form-grid .ghost {
  align-self: end;
}
.edit-banner {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid #f0c36a;
  border-radius: 6px;
  background: #fff7df;
  color: #72520d;
  font-weight: 700;
}
.report-tabs,
.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.report-tabs .active,
.section-tabs .active {
  background: var(--accent);
  color: #fff;
}
.report-view {
  display: none;
}
.report-view.active {
  display: block;
}
.company-tabs {
  position: sticky;
  top: 76px;
  z-index: 8;
  width: fit-content;
  max-width: 100%;
  padding: 5px;
  margin: 18px auto 22px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: #171a22;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .22);
}
.company-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: transparent;
  color: #e8ecf7;
  font-weight: 900;
  box-shadow: none;
}
.company-tabs button:hover {
  background: rgba(255, 255, 255, .08);
}
.section-tabs.company-tabs .active {
  background: linear-gradient(135deg, #2f7df6, #7b4dff);
  color: #fff;
  box-shadow: 0 8px 18px rgba(47, 125, 246, .35);
}
.company-view {
  display: none;
}
.company-view.active {
  display: block;
}
.ranking-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.ranking-split:empty {
  display: block;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 26, 20, 0.55);
}
.modal-panel {
  width: min(1060px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  box-shadow: var(--shadow);
}
.ranking-config {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.ranking-config table,
.ranking-config tr,
.ranking-config td,
.ranking-config th {
  -webkit-user-select: none;
  user-select: none;
}
.ranking-config .table-wrap {
  margin: 10px 0 14px;
}
.map-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 6px;
  background: #e6f4ea;
  color: #166534;
  font-weight: 700;
}
.audit-action {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.audit-delete {
  background: #fee2e2;
  color: #991b1b;
}
.audit-update {
  background: #ffedd5;
  color: #9a3412;
}
.audit-insert {
  background: #dcfce7;
  color: #166534;
}
.customer-order-panel,
.faq-panel {
  margin-top: 14px;
  padding: 16px;
}
.whatsapp-link {
  text-align: center;
  color: #166534;
  font-weight: 700;
}
.sale-total-preview {
  min-height: 40px;
  align-self: end;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faf4;
  color: var(--muted);
}
.sale-total-preview strong {
  color: var(--ink);
}
.sale-payment-amount,
.sale-payment-method {
  min-width: 0;
}

#salePaymentMethodField select {
  min-width: 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  align-self: end;
}
.check input {
  width: 18px;
  min-height: 18px;
}
.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
th {
  font-size: 12px;
  color: var(--muted);
  background: #f6f8f3;
}
tr:last-child td { border-bottom: 0; }
.row-actions {
  display: flex;
  gap: 6px;
}
.row-actions button {
  min-height: 32px;
  border-radius: 5px;
  background: #eef3e8;
  color: var(--ink);
  padding: 0 10px;
}
.context-menu {
  position: fixed;
  z-index: 200;
  min-width: 190px;
  display: none;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.context-menu.open {
  display: grid;
  gap: 4px;
}
.context-menu button {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 10px;
  text-align: left;
  background: transparent;
  color: var(--ink);
}
.context-menu button:hover {
  background: #eef3e8;
}
.context-menu button.danger {
  background: transparent !important;
  color: var(--danger) !important;
}
tr[data-menu] {
  cursor: context-menu;
}
.customer-panel {
  width: min(980px, calc(100% - 28px));
  margin: 24px auto;
  display: grid;
  gap: 16px;
}
.customer-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.customer-head p {
  margin: 0 0 4px;
  color: var(--muted);
}
.customer-head h1 {
  margin: 0;
  letter-spacing: 0;
}
.customer-head strong {
  font-size: 30px;
  color: var(--accent);
}
.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.compact-form {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  margin: 12px 0;
}
.permissions-box {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101116;
}
.permissions-box label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f6f7fb;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}
.permissions-box input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
}

#tab-users .table-wrap table {
  min-width: 0;
}

#tab-users .split-grid > div {
  min-width: 0;
}
.match-panel {
  padding: 12px;
  border: 1px solid #e4cf96;
  border-radius: 8px;
  background: #fff8da;
  color: var(--ink);
}
.match-panel h3 {
  margin-bottom: 8px;
  font-size: 15px;
}
.match-panel button {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 10px;
  margin: 4px 6px 4px 0;
  background: #fff;
  color: var(--ink);
  border: 1px solid #e4cf96;
}
.danger {
  background: #f3e7e4 !important;
  color: var(--danger) !important;
}
.tab.locked {
  display: none;
}
.actions {
  display: flex;
  justify-content: flex-end;
}
.summary-sheet {
  display: grid;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.summary-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.summary-title img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}
.summary-title h1,
.summary-title p {
  margin: 0;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.summary-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.summary-grid strong {
  display: block;
  margin-top: 4px;
}
@media (max-width: 900px) {
  .topbar {
    height: 64px;
    padding: 0 12px;
  }
  .brand {
    min-width: 0;
    font-size: 16px;
  }
  .brand img {
    width: 40px;
    height: 40px;
  }
  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  main {
    min-height: calc(100vh - 64px);
  }
  .menu-toggle {
    display: grid !important;
  }
  .login-grid {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 64px);
    padding: 18px;
    align-content: center;
    background: var(--paper);
  }
  .welcome {
    text-align: center;
    margin: 0 auto;
  }
  .welcome img {
    width: 96px;
    height: 96px;
  }
  .welcome h1 {
    font-size: 30px;
  }
  .welcome p {
    font-size: 15px;
  }
  .workspace {
    display: block;
  }
  .sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    z-index: 40;
    width: min(82vw, 320px);
    height: calc(100vh - 64px);
    min-height: 0;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
    border-right: 1px solid var(--line);
  }
  body.menu-open .sidebar {
    transform: translateX(0);
  }
  .menu-backdrop {
    display: none;
    position: fixed;
    inset: 64px 0 0 0;
    z-index: 35;
    background: rgba(34, 49, 42, .35);
  }
  body.menu-open .menu-backdrop {
    display: block;
  }
  .content {
    padding: 14px;
  }
  .metric-grid,
  .form-grid,
  .compact,
  .split-grid,
  .ranking-split,
  .permissions-box,
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .section-head,
  .customer-head {
    align-items: stretch;
    flex-direction: column;
  }
  .filters {
    flex-direction: column;
  }
  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }
  table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }
  thead {
    display: none;
  }
  tr {
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(34, 49, 42, .07);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
  td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 10px;
    padding: 5px 0;
    border-bottom: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  tr:not(.expanded) .mobile-extra {
    display: none;
  }
  tr::after {
    content: "Tocar para ver más. Mantener presionado para acciones.";
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
  }
}

/* Login unico: mas cercano a la pagina anterior */
#loginView.login-grid {
  min-height: calc(100vh - 84px);
  grid-template-columns: minmax(280px, 430px);
  justify-content: center;
  align-content: center;
  gap: 14px;
  padding: 26px;
  background:
    radial-gradient(circle at top, rgba(255, 213, 79, .45), transparent 34%),
    linear-gradient(180deg, #fff8df 0%, #fff1bd 100%);
}

#loginView .welcome {
  max-width: 430px;
  margin: 0 auto;
  text-align: center;
}

#loginView .welcome img {
  width: 150px;
  height: 150px;
  padding: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 5px 16px rgba(128, 84, 0, .2);
}

#loginView .welcome h1 {
  margin: 10px 0 4px;
  color: #2b2112;
  font-size: 34px;
  text-shadow: none;
}

#loginView .welcome p {
  margin: 0;
  color: #8b5d00;
  font-weight: 800;
}

#loginForm.auth-panel {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 22px;
  gap: 13px;
  background: #fff;
  color: #2b2112;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(128, 84, 0, .2);
}

#loginForm h2 {
  padding: 0;
  color: #2b2112;
  text-align: center;
  font-size: 24px;
  text-shadow: none;
}

#loginForm label {
  color: #3a2b14;
  text-align: center;
  font-weight: 900;
}

#loginForm input {
  min-height: 42px;
  background: #fffaf0;
  border: 1px solid #dfc06d;
  color: #201408;
  border-radius: 6px;
  text-align: center;
}

#loginForm .primary {
  min-height: 42px;
  margin-top: 2px;
  border-radius: 6px;
  background: #2f7df6;
  box-shadow: 0 4px 10px rgba(47, 125, 246, .25);
}

#loginForm .whatsapp-link {
  color: #805b20;
  font-weight: 900;
  text-align: center;
}

#loginForm .error {
  text-align: center;
}

#ownerAccess.brand {
  cursor: default;
}

body.login-mode .topbar {
  height: 90px;
  justify-content: flex-start;
  padding: 0 28px;
  background: #85633f;
  border-bottom: 2px solid rgba(49, 30, 12, .58);
  box-shadow: none;
}

body.login-mode .brand {
  color: #fff;
  align-items: center;
  gap: 14px;
  font-size: 0;
  line-height: 1.08;
  text-shadow: none;
}

body.login-mode .brand img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: transparent;
  padding: 0;
}

body.login-mode .brand-copy {
  display: grid;
  gap: 5px;
}

body.login-mode .brand-copy > span {
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

body.login-mode .brand small {
  display: block;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-shadow: none;
}

body.login-mode .session-actions,
body.login-mode #menuToggle,
body.login-mode #logoutBtn {
  display: none !important;
}

@media (max-width: 900px) {
  #loginView.login-grid {
    min-height: calc(100vh - 76px);
    padding: 18px;
  }

  #loginView .welcome img {
    width: 124px;
    height: 124px;
  }

  #loginView .welcome h1 {
    font-size: 28px;
  }

  #loginForm.auth-panel {
    padding: 18px;
  }
}

/* Login del dominio con fotos */
#loginView.login-grid {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 24px;
  min-height: calc(100vh - 84px);
  padding: 28px 22px;
  background:
    radial-gradient(circle at 7% 82%, rgba(187, 116, 40, .2) 0 5px, transparent 6px),
    radial-gradient(circle at 94% 78%, rgba(224, 157, 52, .25) 0 5px, transparent 6px),
    repeating-linear-gradient(90deg, rgba(113, 74, 29, .045) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(0deg, rgba(113, 74, 29, .035) 0 1px, transparent 1px 8px),
    radial-gradient(circle at top, #fff2df 0, #f3dfbd 48%, #e8d0aa 100%);
}

.login-page-title {
  width: min(1600px, 100%);
  margin: 0 auto -4px;
  text-align: center;
  color: #7b431f;
}

.login-page-title h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1;
  color: #a55d31;
  text-shadow: 0 2px 0 #f5d6b4, 0 4px 8px rgba(72, 38, 17, .25);
}

.login-page-title p {
  margin: 4px 0 0;
  font-size: clamp(16px, 1.7vw, 24px);
  color: #7a4023;
}

.login-page-title p::after {
  content: " \1F413";
}

.login-hero {
  width: min(1720px, calc(100vw - 54px));
  margin: 0 auto;
  display: block;
}

.login-carousel {
  position: relative;
  min-height: clamp(286px, 30vw, 455px);
  display: grid;
  grid-template-columns: minmax(520px, 1.55fr) repeat(3, minmax(165px, .52fr));
  gap: 18px;
  align-items: center;
  overflow: visible;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 14px 32px rgba(89, 54, 23, .22);
}

.login-carousel::after {
  display: none;
}

.login-carousel img {
  position: static;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 1;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(74, 44, 19, .25);
}

.login-feature-img {
  min-height: clamp(286px, 30vw, 455px);
  object-fit: cover;
  filter: saturate(.96) contrast(.98);
}

.login-side-img {
  height: clamp(230px, 24vw, 375px) !important;
  min-height: 0;
  align-self: center;
  object-fit: cover;
  background: #f8ead2;
  transition: opacity .18s ease, transform .25s ease, box-shadow .25s ease;
}

.login-side-img.featured-side {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(74, 44, 19, .32), 0 0 0 3px rgba(184, 113, 52, .22);
}

.login-side-img.carousel-changing {
  opacity: .2;
}

.login-hero-copy {
  position: absolute;
  z-index: 2;
  left: 28px;
  bottom: 22px;
  width: min(520px, 39%);
  padding: 16px 18px;
  border-radius: 0 18px 18px 0;
  background: linear-gradient(90deg, rgba(54, 29, 12, .78), rgba(81, 44, 18, .48));
  color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,.75);
}

.login-hero-copy h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 2.4vw, 40px);
  line-height: 1.05;
}

.login-hero-copy p {
  margin: 0 0 8px;
  font-size: clamp(13px, 1.1vw, 17px);
}

.login-hero-copy strong {
  color: #ffefad;
  font-style: italic;
}

.login-carousel-dots {
  position: absolute;
  z-index: 3;
  left: 50%;
  right: 0;
  bottom: 10px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.login-carousel-dots button {
  width: 16px;
  height: 10px;
  min-height: 10px;
  padding: 0;
  border-radius: 999px;
  background: rgba(83, 58, 38, .42);
  border: 1px solid rgba(255,255,255,.35);
}

.login-carousel-dots button.active {
  width: 28px;
  background: #8d6a4f;
  transform: none;
}

.login-actions {
  width: min(1720px, calc(100vw - 54px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, .9fr);
  gap: 24px;
  align-items: stretch;
}

#loginForm.auth-panel,
.login-order-card,
.login-faq-card {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 28px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 10%, rgba(172, 106, 53, .08), transparent 26%),
    linear-gradient(135deg, rgba(255,252,246,.98), rgba(255,246,231,.96));
  border: 1px solid rgba(139, 92, 45, .18);
  box-shadow: 0 14px 28px rgba(89, 54, 23, .2);
}

#loginForm.auth-panel::before,
.login-order-card::before,
.login-faq-card::before {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: -1;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(93,148,85,.35), rgba(255,235,150,.5));
}

.login-card-head {
  display: flex;
  gap: 14px;
  align-items: center;
}

.login-card-head img {
  width: 58px;
  height: 76px;
  object-fit: contain;
  border-radius: 50% 50% 48% 52% / 64% 64% 42% 42%;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 229, 180, .45), transparent 22%),
    linear-gradient(155deg, #c98b4a 0%, #9a5a2b 62%, #72401e 100%);
  padding: 10px 7px 8px;
  box-shadow: inset -3px -5px 0 rgba(73, 35, 13, .18), 0 3px 8px rgba(84, 48, 20, .2);
}

#loginForm h2,
.login-order-card h2,
.login-faq-card h2 {
  margin: 0;
  padding: 0;
  color: #3f2b17;
  text-align: left;
  font-size: 24px;
  text-shadow: none;
}

.login-card-head p,
.login-order-card p,
.login-faq-card p {
  margin: 5px 0 0;
  color: #6b4b2b;
  font-weight: 700;
}

#loginForm label {
  color: #3f2b17;
  text-align: left;
}

#loginForm input {
  text-align: left;
  min-height: 44px;
  border: 3px solid transparent;
  border-radius: 12px;
  background:
    linear-gradient(#fffaf3, #fffaf3) padding-box,
    repeating-linear-gradient(135deg, #9b6a3b 0 3px, #ead4b2 3px 7px, #b88451 7px 10px, #f7e7ce 10px 14px) border-box;
  box-shadow: inset 0 1px 3px rgba(88, 48, 18, .1), 0 1px 0 rgba(113, 68, 29, .12);
}

#loginForm input::-ms-reveal,
#loginForm input::-ms-clear {
  display: none;
}

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

.password-field button {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  transform: translateY(-50%);
  border-radius: 50%;
  background: transparent;
}

.password-field input {
  padding-right: 50px;
}

.password-field button::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 12px;
  width: 22px;
  height: 14px;
  border: 3px solid #9b6a3b;
  border-radius: 50%;
  background: #fff8e8;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.75), 0 1px 2px rgba(70, 42, 18, .16);
}

.password-field button::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 17px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7b4a21;
  opacity: 1;
  transform: none;
}

.password-field button.visible::after {
  background: #3d6b3d;
}

.password-field button.visible::before {
  border-color: #3d6b3d;
  background: #fff8e8;
}

.remember-login {
  position: relative;
  display: inline-flex;
  width: fit-content;
  min-height: 46px;
  align-self: start;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6b451d !important;
  font-weight: 800;
  box-shadow: none;
}

.remember-login::before {
  content: "";
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  background: url("../public/login/login-nest-check-cut.png") center / contain no-repeat;
  filter: drop-shadow(0 2px 2px rgba(82, 48, 21, .18));
}

.remember-login input {
  appearance: none;
  position: absolute;
  width: 1px !important;
  height: 1px;
  min-height: 1px !important;
  opacity: 0;
  margin: 0;
  padding: 0;
  border: 0 !important;
  pointer-events: none;
}

#loginForm .primary,
.login-order-card .primary {
  min-height: 54px;
  background: url("../public/login/objetos/btn-whatsapp-tight.png") center / 100% 100% no-repeat;
  color: transparent;
  text-shadow: none;
  box-shadow: none;
}

#loginForm .primary {
  background: #3d6b3d;
  color: #fff;
  box-shadow: 0 4px 0 #254625;
}

.login-order-card .primary:hover {
  background: url("../public/login/objetos/btn-whatsapp-tight.png") center / 100% 100% no-repeat;
}

#loginForm .primary:hover {
  background: #4f8048;
}

#loginForm .primary,
.login-order-card .primary {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #3d6b3d;
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  box-shadow: 0 4px 0 #254625;
}

.login-order-card .primary::after {
  display: none;
}

.login-order-card .primary::before {
  display: none;
}

#loginForm .primary:hover,
.login-order-card .primary:hover {
  background: #4f8048;
}

.login-order-card .primary {
  min-height: 54px;
  background: url("../public/login/objetos/btn-whatsapp-tight.png") center / 100% 100% no-repeat;
  color: transparent;
  text-shadow: none;
  box-shadow: none;
}

.login-order-card .primary:hover {
  background: url("../public/login/objetos/btn-whatsapp-tight.png") center / 100% 100% no-repeat;
}

.login-order-card,
.login-faq-card {
  display: grid;
  align-content: center;
  gap: 14px;
}

.login-order-card::after {
  content: "";
  width: 150px;
  height: 104px;
  justify-self: center;
  order: -1;
  margin-bottom: 4px;
  background: url("../public/login/objetos/canasta-huevos-clean.png") center / contain no-repeat;
  border-radius: 0;
  filter: drop-shadow(0 4px 3px rgba(82, 48, 21, .16));
}

.login-order-card strong {
  display: inline-block;
  width: fit-content;
  padding: 10px 12px;
  border-radius: 999px;
  color: #5a3b17;
  background: #ffefcc;
  border: 1px solid #e2c075;
}

.gallery-button {
  display: inline-flex;
  border: 0;
  min-height: 46px;
  min-width: 210px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  padding: 0 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #9a642f, #764818);
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 900;
  box-shadow: 0 4px 0 #4e2f14;
}

.gallery-button::before {
  content: "📷";
  margin-right: 8px;
}

.login-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.login-submit-row .primary {
  width: auto;
  min-width: 118px;
  padding: 0 18px;
}

#forgotPasswordLink {
  color: #3d6b3d;
  font-weight: 900;
  text-decoration: none;
}

#forgotPasswordLink:hover,
.instagram-link:hover {
  text-decoration: underline;
}

.login-faq-card p {
  margin: 0;
  color: #5d4520;
  line-height: 1.35;
}

.login-faq-card h2 {
  margin: 0;
  color: #7b4f1d;
}

.login-note {
  margin: 2px 0 0;
  color: #6b4b2b;
  line-height: 1.35;
}

.instagram-link {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: #b56b00;
  font-weight: 900;
  text-decoration: none;
}

.instagram-link img {
  width: 28px;
  height: 28px;
  display: block;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  overflow-y: auto;
  padding: 54px 18px 24px;
  background: rgba(0,0,0,.9);
}

.gallery-close {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 301;
  min-height: 38px;
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  color: #111;
  font-weight: 900;
}

.gallery-content {
  width: min(980px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.gallery-content img {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 12px;
  background: #111;
}

.gallery-content video {
  width: 100%;
  max-height: 82vh;
  border-radius: 12px;
  background: #111;
}

.gallery-button::before {
  content: "";
  width: 34px;
  height: 34px;
  margin-right: 8px;
  background: url("../public/login/login-gallery-feather-cut.png") center / contain no-repeat;
}

/* Login refinado con objetos exportados para la pantalla principal. */
#loginView.login-grid {
  background: #f4e0bc url("../public/login/objetos/fondo-Photoroom.png") center top / cover no-repeat;
}

#loginForm.auth-panel {
  background: transparent url("../public/login/objetos/fondo-card-izquierda-Photoroom.png") center / 100% 100% no-repeat;
  border: 0;
  box-shadow: none;
  padding: clamp(22px, 2.2vw, 36px);
}

.login-order-card {
  background: transparent url("../public/login/objetos/fondo-card-derecha-Photoroom.png") center / 100% 100% no-repeat;
  border: 0;
  box-shadow: none;
  padding: clamp(34px, 3.4vw, 58px);
}

#loginForm.auth-panel::before,
.login-order-card::before {
  display: none;
}

#loginForm input {
  border: 3px solid transparent;
  background:
    linear-gradient(#fffaf3, #fffaf3) padding-box,
    repeating-linear-gradient(135deg, #9c6a3d 0 3px, #e8cc9f 3px 7px, #b77d45 7px 10px, #f6dfbb 10px 14px) border-box;
  box-shadow: inset 0 1px 3px rgba(77, 38, 12, .12);
}

.gallery-button {
  min-width: 235px;
  min-height: 58px;
  padding: 0;
  background: url("../public/login/objetos/btn-galeria-Photoroom.png") center / 100% 100% no-repeat;
  color: transparent;
  box-shadow: none;
}

.gallery-button::before {
  display: none;
}

#loginForm .primary {
  width: 142px;
  min-width: 142px;
  min-height: 58px;
  padding: 0;
  background: url("../public/login/objetos/btn-ingresar-Photoroom.png") center / 100% 100% no-repeat;
  color: transparent;
  box-shadow: none;
}

#loginForm .primary:hover {
  background: url("../public/login/objetos/btn-ingresar-Photoroom.png") center / 100% 100% no-repeat;
}

.login-order-card .primary,
.login-order-card .primary:hover {
  width: 100%;
  min-height: 64px;
  padding: 0;
  background: url("../public/login/objetos/btn-whatsapp-Photoroom.png") center / 100% 100% no-repeat;
  color: transparent;
  box-shadow: none;
}

.login-order-card::after {
  width: 190px;
  height: 150px;
  margin-bottom: 12px;
  background: url("../public/login/objetos/canasta-huevos-Photoroom.png") center / contain no-repeat;
}

.remember-login {
  min-height: 54px;
  padding: 0;
  gap: 0;
  background: url("../public/login/objetos/check-sesion-Photoroom.png") left center / contain no-repeat;
  color: transparent !important;
}

.remember-login::before {
  display: none;
}

.remember-login span {
  visibility: hidden;
  display: inline-block;
  min-width: min(430px, 58vw);
}

.login-card-head h2 {
  color: #8d5030;
}

#loginView #loginForm.auth-panel,
#loginView .login-order-card {
  filter: drop-shadow(0 16px 18px rgba(89, 54, 23, .18));
  transform: translateY(-2px);
}

#loginView #loginForm.auth-panel::after,
#loginView .login-order-card::before {
  content: "";
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: -8px;
  height: 16px;
  border-radius: 50%;
  background: rgba(91, 52, 21, .16);
  filter: blur(8px);
  z-index: -1;
}

#loginView .login-hero-copy {
  left: 28px !important;
  right: auto !important;
  width: calc(50% - 56px) !important;
  padding: 12px 18px !important;
  background: linear-gradient(90deg, rgba(54, 29, 12, .58), rgba(81, 44, 18, .26)) !important;
}

#loginView .login-hero-copy h1 {
  margin-bottom: 4px !important;
  font-size: clamp(24px, 2vw, 34px) !important;
  white-space: nowrap !important;
}

#loginView .login-hero-copy p {
  max-width: none !important;
  margin-bottom: 6px !important;
  font-size: clamp(12px, .9vw, 15px) !important;
  white-space: nowrap !important;
}

/* Botones del login: mejor como controles reales, no como imagen escalada. */
.gallery-button {
  min-width: 220px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #b36a3e, #88451f);
  color: #fff;
  box-shadow: 0 4px 0 #5a2c14, 0 8px 18px rgba(84, 44, 19, .22);
}

.gallery-button::before {
  display: inline-flex;
  width: auto;
  height: auto;
  margin-right: 8px;
  background: none;
  content: "\1FAB6";
  color: #fff;
  font-size: 20px;
}

#loginForm .primary,
#loginForm .primary:hover {
  width: auto;
  min-width: 120px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #477b43, #2f5f33);
  color: #fff;
  box-shadow: 0 4px 0 #214524, 0 8px 16px rgba(39, 78, 42, .2);
}

.login-order-card .primary,
.login-order-card .primary:hover {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #477b43, #2f5f33);
  color: #fff;
  text-shadow: none;
  box-shadow: 0 4px 0 #214524, 0 8px 16px rgba(39, 78, 42, .2);
}

.login-order-card .primary::before {
  display: inline-flex;
  content: "\1F4AC";
  margin-right: 8px;
  font-size: 19px;
}

.login-order-card .primary::after {
  display: inline-flex;
  content: "\1FAB6";
  width: auto;
  height: auto;
  margin-left: 8px;
  background: none;
  font-size: 19px;
}

@media (max-width: 900px) {
  #loginView.login-grid {
    min-height: calc(100vh - 76px);
    padding: 12px;
    gap: 16px;
  }

  .login-hero,
  .login-actions {
    grid-template-columns: 1fr;
  }

  .login-carousel {
    min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .login-feature-img {
    grid-column: 1 / -1;
    min-height: 220px;
    height: 220px !important;
  }

  .login-side-img {
    min-height: 86px;
    height: 86px !important;
    width: 100%;
  }

  .login-hero-copy {
    left: 18px;
    right: auto;
    bottom: 18px;
    width: calc(100% - 36px);
    padding: 14px 16px;
  }

  #loginView .login-hero-copy {
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    bottom: 102px !important;
    padding: 8px 10px !important;
    border-radius: 0 12px 12px 0 !important;
  }

  .login-hero-copy h1 {
    font-size: 24px;
    max-width: 360px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .login-hero-copy p {
    display: none;
  }

  #loginView .login-hero-copy h1 {
    font-size: 20px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #loginView .login-hero-copy p {
    display: none !important;
  }

  #loginView .gallery-button,
  #loginView .gallery-button:hover {
    min-width: 170px !important;
    min-height: 44px !important;
    padding: 0 14px !important;
  }

  .login-carousel-dots {
    left: 0;
    bottom: 90px;
  }

  #loginForm.auth-panel,
  .login-order-card,
  .login-faq-card {
    padding: 26px 24px;
  }

  #loginView .login-order-card {
    padding: 34px 28px 36px;
  }

  #loginView #loginForm.auth-panel {
    margin: 10px 10px 0;
    width: calc(100% - 20px);
  }

  .login-card-head img {
    width: 54px;
    height: 70px;
    padding: 9px 7px 8px;
  }

  .gallery-button {
    min-height: 46px;
    width: 100%;
    margin-top: 10px;
  }

  .login-submit-row {
    align-items: center;
  }

  .login-submit-row .primary {
    min-width: 86px;
  }

  body.login-mode .topbar {
    height: 90px;
    padding: 0 22px;
  }

  body.login-mode .brand {
    font-size: 0;
  }

  body.login-mode .brand img {
    width: 40px;
    height: 40px;
  }

  body.login-mode .brand-copy > span {
    font-size: 21px;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  body.login-mode .brand small {
    font-size: 14px;
  }
}

/* Pagina del cliente: estilo calido de la version anterior */
body.customer-mode {
  color: #33220b;
  background: linear-gradient(180deg, #fff8df 0%, #fff1bd 100%);
}

body.customer-mode .topbar {
  height: 86px;
  background: linear-gradient(90deg, #ffb300, #ffd54f);
  box-shadow: 0 3px 10px rgba(128, 84, 0, .16);
}

body.customer-mode .brand {
  color: #fff;
  font-size: 26px;
  text-shadow: 0 2px 0 rgba(124, 77, 0, .35);
}

body.customer-mode .brand img {
  background: #fff;
  border-radius: 50%;
  padding: 4px;
}

body.customer-mode #menuToggle {
  display: none !important;
}

body.customer-mode main {
  background: linear-gradient(180deg, #fff8df 0%, #fff1bd 100%);
}

.customer-panel {
  width: min(920px, calc(100% - 22px));
  margin: 18px auto 28px;
  gap: 15px;
}

.customer-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #2a2215 0%, #17181d 58%, #101113 100%);
  border: 1px solid rgba(255, 198, 41, .25);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 3px 10px rgba(128, 84, 0, .12);
}

.customer-head img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 5px;
}

.customer-head p {
  margin: 0 0 4px;
  color: #d89b00;
  font-weight: 800;
}

.customer-head h1 {
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.customer-head strong {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-width: 132px;
  color: #fff;
  font-size: 24px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 211, 91, .45);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: none;
}

.customer-head strong::before {
  content: "Saldo actual";
  color: #ffd36a;
  font-size: 12px;
  font-weight: 800;
}

.customer-loyalty {
  padding: 16px;
  text-align: center;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 12px rgba(128, 84, 0, .14);
}

.customer-loyalty h2 {
  padding: 0;
  color: #ff9800;
  text-align: center;
  font-size: 22px;
  text-shadow: none;
}

.customer-loyalty p {
  margin: 8px 0;
  color: #4a3b24;
}

.customer-progress {
  width: min(520px, 92%);
  height: 25px;
  margin: 10px auto;
  overflow: hidden;
  border-radius: 999px;
  background: #ece7db;
}

.customer-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb300, #4caf50);
  transition: width .35s ease;
}

.customer-meta {
  color: #6f4e16 !important;
  font-size: 14px;
  font-weight: 800;
}

.customer-panel .metric-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.customer-panel .metric {
  min-height: 112px;
  text-align: center;
  background: #fff;
  border: 0;
  border-radius: 15px;
  padding: 18px 14px;
  box-shadow: 0 3px 10px rgba(128, 84, 0, .13);
}

.customer-panel .metric span {
  color: #62553f;
  font-size: 14px;
  font-weight: 800;
}

.customer-panel .metric strong {
  margin-top: 8px;
  color: #111;
  font-size: 27px;
}

.customer-rank-card {
  cursor: pointer;
}

.customer-rank-card p {
  margin: 8px 0 0;
  color: #7b6b55;
  font-size: 13px;
  font-weight: 800;
}

.customer-panel .actions {
  justify-content: center;
  gap: 10px;
}

.customer-panel .ghost,
.customer-panel .primary {
  min-height: 44px;
  border-radius: 999px;
  background: #ffb300;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(128, 84, 0, .18);
}

.customer-panel .customer-order-panel,
.customer-panel .faq-panel {
  background: #fff;
  color: #33220b;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(128, 84, 0, .14);
}

.customer-panel .customer-order-panel h2,
.customer-panel .faq-panel h2 {
  padding: 0;
  color: #ff9800;
  text-align: center;
  font-size: 24px;
  text-shadow: none;
}

.customer-panel .form-grid {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 8px 0 0;
}

.customer-panel label {
  color: #3c2e18;
}

.customer-panel input,
.customer-panel select {
  background: #fffaf0;
  border-color: #f3cd74;
  color: #251807;
}

.customer-product-fixed {
  display: grid;
  align-content: center;
  min-height: 62px;
  padding: 10px 14px;
  border: 1px solid #f3cd74;
  border-radius: 10px;
  background: #fffaf0;
}

.customer-product-fixed span {
  color: #76552a;
  font-size: 12px;
  font-weight: 800;
}

.customer-product-fixed strong {
  color: #251807;
  font-size: 18px;
}

.customer-order-note {
  margin: 10px 0 0;
  color: #6b5634;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
}

.customer-order-success {
  margin: 12px auto 0;
  width: fit-content;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid #8ac06b;
  border-radius: 999px;
  background: #eefbe8;
  color: #2f6f22;
  font-weight: 900;
  text-align: center;
}

.customer-pending-date {
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #f3cd74;
  border-radius: 10px;
  background: #fff8e7;
}

#customerPendingOrder {
  margin: 10px 0 0;
  color: #5d4520;
  text-align: center;
  font-weight: 800;
}

.top3-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(4px);
}

.top3-modal {
  position: relative;
  width: min(480px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  border: 4px solid #b48a61;
  border-radius: 18px;
  background: #f7f2e9;
  color: #3d2d1d;
  text-align: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .35);
}

.top3-cerrar {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #9b6a38;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.top3-titulo {
  margin: 0 0 4px;
  color: #593d27;
  font-size: 24px;
  text-shadow: none;
}

.top3-fechas {
  margin: 0 0 14px;
  color: #7a5d44;
  font-weight: 700;
}

.customer-ranking-current {
  margin: 0 0 14px;
  padding: 14px;
  border-radius: 16px;
  background: #fff8e8;
  border: 1px solid #e2c591;
}

.customer-ranking-current span,
.customer-ranking-current p {
  color: #76552a;
  font-weight: 800;
}

.customer-ranking-current strong {
  display: block;
  margin: 4px 0;
  color: #111;
  font-size: 42px;
}

.top3-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-left: 5px solid #d4a373;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .08);
}

.top3-row.is-current {
  border-left-color: #3d7a3f;
  background: #f2ffe9;
}

.top3-medalla {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1d7a7;
  color: #593d27;
  font-weight: 900;
}

.top3-datos {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.top3-nombre {
  color: #4a3f35;
  font-weight: 900;
}

.top3-cantidad {
  color: #6d4c41;
  font-weight: 900;
  white-space: nowrap;
}

.customer-ranking-next,
.customer-ranking-prizes {
  margin: 12px 0 0;
  color: #5f472a;
  font-weight: 800;
}

.customer-ranking-prizes h3 {
  margin: 12px 0 6px;
  color: #8a5a23;
}

.faq-panel p {
  color: #44351c;
}

.site-footer {
  margin: 22px 0 8px;
  text-align: center;
  color: #6c5025;
  font-weight: 800;
}

.back-home,
.customer-back {
  width: fit-content;
  margin: 0 0 12px;
}

.loyalty-panel {
  margin-top: 18px;
  padding: 18px;
}

.loyalty-panel h3 {
  margin: 18px 0 8px;
}

.mini-action {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.delivery-plan-panel {
  margin-top: 18px;
  padding: 18px;
}

.plan-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 12px;
}

.plan-summary span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef3e8;
  color: #2d2418;
  font-weight: 800;
}

.plan-summary span strong {
  color: inherit;
}

.plan-summary .plan-warning {
  background: #ffe3e3;
  color: #9b1c1c;
}

.plan-summary .plan-ok {
  background: #e3f8df;
  color: #235c24;
}

.balance-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.balance-totals span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f4f6ef;
  color: #21351f;
  font-weight: 800;
}

.balance-totals .balance-total-all {
  background: #e3f8df;
  color: #235c24;
}

tr.over-capacity td {
  background: rgba(255, 71, 120, .08);
}

@media (max-width: 900px) {
  body.customer-mode .topbar {
    height: 76px;
    padding: 0 14px;
  }

  body.customer-mode .brand {
    font-size: 20px;
  }

  .customer-panel {
    width: calc(100% - 18px);
    margin-top: 12px;
  }

  .customer-head {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .customer-head strong {
    grid-column: 1 / -1;
    justify-self: start;
    text-align: center;
    font-size: 26px;
    min-width: 0;
    width: auto;
  }

  .customer-head h1 {
    font-size: 24px;
  }

  .customer-panel .metric-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .customer-panel .metric {
    min-height: 104px;
    padding: 14px 10px;
  }

  .customer-panel .metric strong {
    font-size: 23px;
  }

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

  .customer-panel .customer-order-panel,
  .customer-panel .faq-panel {
    padding: 14px;
  }

  #customerOrderForm {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #customerOrderForm label {
    grid-column: span 1;
  }

  #customerOrderForm label:nth-of-type(3),
  #customerOrderForm .check,
  #customerOrderForm .primary {
    grid-column: 1 / -1;
  }
}

@media print {
  body {
    background: #fff;
  }
  .topbar,
  .sidebar,
  .menu-backdrop,
  .no-print,
  .tab-page:not(#tab-client-summary):not(#tab-seller-summary) {
    display: none !important;
  }
  #ownerView,
  .workspace,
  .content,
  #tab-client-summary,
  #tab-seller-summary {
    display: block !important;
    padding: 0 !important;
  }
  .summary-print:not(.active) {
    display: none !important;
  }
  #tab-client-summary.summary-print:not(.active),
  #tab-seller-summary.summary-print:not(.active) {
    display: none !important;
  }
  .summary-sheet {
    border: 0;
    padding: 0;
    gap: 8px !important;
  }
  .summary-title {
    gap: 8px !important;
    margin-bottom: 4px !important;
  }
  .summary-title img {
    width: 34px !important;
    height: 34px !important;
  }
  .summary-title h1 {
    font-size: 22px !important;
    line-height: 1.05 !important;
  }
  .summary-title p {
    font-size: 11px !important;
  }
  .client-summary-grid {
    grid-template-columns: 1.5fr 1fr 1fr !important;
    gap: 4px !important;
  }
  .client-summary-grid div {
    border-radius: 4px !important;
    padding: 4px 6px !important;
  }
  .client-summary-grid span {
    font-size: 9px !important;
    line-height: 1.1 !important;
  }
  .client-summary-grid strong {
    margin-top: 1px !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
  }
  .table-wrap {
    overflow: visible !important;
    background: #fff !important;
    border: 0 !important;
  }
  table {
    display: table !important;
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: collapse !important;
  }
  thead {
    display: table-header-group !important;
  }
  tbody {
    display: table-row-group !important;
  }
  tr {
    display: table-row !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  th,
  td {
    display: table-cell !important;
    border: 1px solid #d7d7d7 !important;
    padding: 7px !important;
    text-align: left !important;
    color: #111 !important;
  }
  #clientSummaryTable {
    table-layout: fixed !important;
    font-size: 10px !important;
  }
  #clientSummaryTable th,
  #clientSummaryTable td {
    padding: 5px 6px !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  #clientSummaryTable th:nth-child(1),
  #clientSummaryTable td:nth-child(1) {
    width: 66px !important;
    white-space: nowrap !important;
  }
  #clientSummaryTable th:nth-child(2),
  #clientSummaryTable td:nth-child(2) {
    width: 34% !important;
    white-space: normal !important;
  }
  #clientSummaryTable th:nth-child(3),
  #clientSummaryTable td:nth-child(3) {
    width: 42px !important;
    text-align: center !important;
  }
  #clientSummaryTable th:nth-child(4),
  #clientSummaryTable td:nth-child(4),
  #clientSummaryTable th:nth-child(5),
  #clientSummaryTable td:nth-child(5),
  #clientSummaryTable th:nth-child(6),
  #clientSummaryTable td:nth-child(6),
  #clientSummaryTable th:nth-child(7),
  #clientSummaryTable td:nth-child(7) {
    width: 64px !important;
    white-space: nowrap !important;
  }
  td::before {
    content: none !important;
  }
  tr::after {
    content: none !important;
    display: none !important;
  }
}

@media (min-width: 901px) {
  .menu-toggle {
    display: none !important;
  }
}

/* Estilo visual inspirado en la pagina anterior */
:root {
  --ink: #f6f7fb;
  --muted: #a7acb8;
  --line: #2b303a;
  --paper: #0f0f10;
  --panel: #17181d;
  --brand: #2f7df6;
  --brand-dark: #1763d8;
  --accent: #8b5cf6;
  --danger: #ff4778;
  --shadow: 0 18px 42px rgba(0, 0, 0, .35);
}

body {
  color: var(--ink);
  background: #101010;
}

.topbar {
  height: 84px;
  justify-content: center;
  gap: 54px;
  background: #000;
  border-bottom: 0;
}

.brand {
  color: #fff;
  font-size: 28px;
  text-shadow: 2px 2px 0 #1d4ed8;
}

.brand img {
  width: 44px;
  height: 44px;
}

.session-actions {
  position: absolute;
  right: 24px;
}

#logoutBtn {
  background: transparent;
  color: #fff;
  font-weight: 800;
}

#logoutBtn::before {
  content: "X ";
  color: var(--danger);
}

main {
  min-height: calc(100vh - 84px);
  background: #111;
}

.workspace {
  display: block;
}

.sidebar {
  min-height: auto;
  padding: 0 18px 22px;
  background: #000;
  border-right: 0;
  display: flex;
  justify-content: center;
  gap: 34px;
}

.tab {
  min-height: 44px;
  border-radius: 0;
  padding: 0 6px;
  color: #fff;
  font-weight: 800;
  background: transparent;
}

.tab::before {
  display: inline-block;
  width: 24px;
}

.tab[data-tab="dashboard"]::before { content: "📊"; }
.tab[data-tab="clients"]::before { content: "👥"; }
.tab[data-tab="sales"]::before { content: "📄"; }
.tab[data-tab="orders"]::before { content: "🧾"; }
.tab[data-tab="deliveries"]::before { content: "🚚"; }
.tab[data-tab="company"]::before { content: "💰"; }
.tab[data-tab="reports"]::before { content: "📈"; }
.tab[data-tab="loyalty"]::before { content: "🎁"; }
.tab[data-tab="catalog"]::before { content: "📦"; }
.tab[data-tab="users"]::before { content: "👤"; }
.tab[data-tab="audit"]::before { content: "🔎"; }

@media print {
  #tab-client-summary .summary-sheet {
    gap: 6px !important;
  }

  #tab-client-summary .summary-title {
    gap: 8px !important;
    margin-bottom: 2px !important;
  }

  #tab-client-summary .summary-title img {
    width: 30px !important;
    height: 30px !important;
  }

  #tab-client-summary .summary-title h1 {
    font-size: 20px !important;
    line-height: 1 !important;
  }

  #tab-client-summary .summary-title p {
    font-size: 10px !important;
  }

  #tab-client-summary .client-summary-grid {
    display: grid !important;
    grid-template-columns: 1.6fr .85fr .9fr .8fr .75fr .75fr !important;
    gap: 3px !important;
  }

  #tab-client-summary .client-summary-grid div {
    padding: 3px 5px !important;
    min-height: 0 !important;
    border-radius: 3px !important;
  }

  #tab-client-summary .client-summary-grid span {
    font-size: 8px !important;
    line-height: 1 !important;
  }

  #tab-client-summary .client-summary-grid strong {
    font-size: 10px !important;
    line-height: 1.05 !important;
    margin-top: 1px !important;
  }

  #clientSummaryTable {
    table-layout: fixed !important;
    font-size: 9px !important;
  }

  #clientSummaryTable th,
  #clientSummaryTable td {
    padding: 4px 5px !important;
  }

  #clientSummaryTable th:nth-child(1),
  #clientSummaryTable td:nth-child(1) {
    width: 74px !important;
  }

  #clientSummaryTable th:nth-child(2),
  #clientSummaryTable td:nth-child(2) {
    width: auto !important;
  }

  #clientSummaryTable th:nth-child(3),
  #clientSummaryTable td:nth-child(3) {
    width: 58px !important;
    text-align: center !important;
  }

  #clientSummaryTable th:nth-child(4),
  #clientSummaryTable td:nth-child(4),
  #clientSummaryTable th:nth-child(5),
  #clientSummaryTable td:nth-child(5),
  #clientSummaryTable th:nth-child(6),
  #clientSummaryTable td:nth-child(6),
  #clientSummaryTable th:nth-child(7),
  #clientSummaryTable td:nth-child(7) {
    width: 68px !important;
    white-space: nowrap !important;
  }
}

.tab.active {
  background: transparent;
  box-shadow: none;
  text-shadow: 2px 2px 0 #1d4ed8;
}

.content {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.tab-page.active {
  gap: 20px;
}

h2 {
  text-align: center;
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  text-shadow: 2px 2px 0 #1d4ed8;
}

h3 {
  color: #fff;
  font-weight: 900;
}

.panel,
.form-grid,
.ranking-config,
.summary-sheet,
.customer-head,
.metric,
.auth-panel,
.customer-order-panel,
.faq-panel {
  background: #17181d;
  border: 1px solid #2a2d36;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

label {
  color: #f5f6fb;
  font-weight: 800;
  font-size: 15px;
}

input,
select {
  min-height: 36px;
  border: 1px solid #303542;
  border-radius: 8px;
  background: #111217;
  color: #fff;
  padding: 7px 10px;
}

input::placeholder {
  color: #858b98;
}

.primary {
  background: #2f7df6;
  color: #fff;
  font-weight: 900;
}

.primary:hover {
  background: #1763d8;
}

.ghost {
  background: #232630;
  color: #fff;
  font-weight: 800;
}

.metric span,
.sale-total-preview,
.summary-grid span {
  color: #c1c5d0;
}

.metric strong,
.sale-total-preview strong,
.customer-head strong {
  color: #fff;
}

.metric-action:hover {
  border-color: #2f7df6;
}

.form-grid {
  gap: 10px 14px;
  padding: 22px;
}

#saleForm {
  width: min(990px, 100%);
  margin: 0 auto;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
}

#saleForm label:nth-of-type(1) { grid-column: 4 / 7; grid-row: 1; }
#saleForm label:nth-of-type(2) { grid-column: 1 / 4; grid-row: 1; }
#saleForm label:nth-of-type(3) { grid-column: 1 / 4; grid-row: 2; }
#saleForm label:nth-of-type(4) { grid-column: 1 / 3; }
#saleForm .sale-maple-field { grid-column: 3 / 5; }
#saleForm .sale-other-field { grid-column: 3 / 5; }
#saleForm .sale-value-field { grid-column: span 2; }
#saleForm .sale-total-preview,
#saleForm .check,
#saleForm label:nth-of-type(9),
#saleForm label:nth-of-type(10),
#saleForm label:nth-of-type(11) {
  grid-column: span 2;
}

#saleForm .primary,
#saleForm .ghost {
  width: max-content;
}

.sale-total-preview {
  background: #111217;
  border-color: #303542;
  border-radius: 8px;
}

.table-wrap {
  background: transparent;
  border: 0;
  border-radius: 8px;
}

table {
  background: #fff;
  color: #030712;
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  border-color: #d6d6d6;
  text-align: center;
}

th {
  background: #eeeeee;
  color: #030712;
  font-weight: 900;
  font-size: 13px;
}

tbody tr:nth-child(even) {
  background: #f0f0f0;
}

tbody tr:nth-child(odd) {
  background: #fff;
}

.context-menu {
  background: #17181d;
  border-color: #303542;
}

.context-menu button {
  color: #fff;
}

.context-menu button:hover {
  background: #252936;
}

.login-grid {
  background: #050505;
}

.welcome h1 {
  color: #fff;
  text-shadow: 2px 2px 0 #1d4ed8;
}

.welcome p {
  color: #d0d4dc;
}

.whatsapp-link {
  color: #7dd3fc;
}

@media (max-width: 900px) {
  .topbar {
    height: 76px;
    justify-content: space-between;
    padding: 0 20px;
  }

  .brand {
    font-size: 21px;
    text-shadow: 1px 1px 0 #1d4ed8;
  }

  .brand img {
    width: 38px;
    height: 38px;
  }

  .session-actions {
    position: static;
  }

  .menu-toggle {
    width: 40px;
    background: transparent;
    border-radius: 0;
  }

  .menu-toggle span {
    height: 4px;
    background: #fff;
  }

  main {
    min-height: calc(100vh - 76px);
  }

  .sidebar {
    top: 76px;
    width: min(82vw, 360px);
    height: calc(100vh - 76px);
    padding: 14px 28px 28px;
    display: grid;
    align-content: start;
    justify-content: stretch;
    gap: 22px;
    background: #000;
    box-shadow: 12px 0 30px rgba(0,0,0,.5);
  }

  .menu-backdrop {
    inset: 76px 0 0 0;
    background: rgba(0,0,0,.45);
  }

  .tab {
    min-height: 56px;
    padding: 0;
    font-size: 22px;
  }

  .tab::before {
    width: 30px;
  }

  .content {
    width: 100%;
    padding: 18px 0 30px;
  }

  .tab-page.active {
    gap: 14px;
  }

  h2 {
    text-align: left;
    padding: 0 20px;
    font-size: 40px;
    line-height: 1.05;
  }

  .form-grid {
    border-left: 0;
    border-right: 0;
    border-radius: 8px 8px 0 0;
    padding: 20px;
  }

  #saleForm {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
  }

  #saleForm label,
  #saleForm label:nth-of-type(1),
  #saleForm label:nth-of-type(2),
  #saleForm label:nth-of-type(3),
  #saleForm label:nth-of-type(4),
  #saleForm .sale-maple-field,
  #saleForm .sale-other-field,
  #saleForm .sale-total-preview,
  #saleForm .check,
  #saleForm label:nth-of-type(9),
  #saleForm label:nth-of-type(10),
  #saleForm label:nth-of-type(11) {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  #saleForm .sale-value-field,
  #saleForm .sale-total-preview,
  #saleForm .sale-payment-amount,
  #saleForm .sale-payment-method {
    grid-column: span 1;
  }

  #saleForm .primary {
    min-height: 38px;
  }

  #saleForm .ghost {
    min-height: 38px;
  }

  label {
    gap: 6px;
    font-size: 15px;
  }

  input,
  select {
    min-height: 38px;
    font-size: 15px;
  }

  .section-head,
  .list-search {
    padding: 0 14px;
  }

  tr {
    background: #fff;
    color: #030712;
    box-shadow: none;
  }

  td::before {
    color: #374151;
  }
}


@page {
  margin: 8mm;
}

@media print {
  body {
    background: #fff !important;
    color: #111 !important;
  }

  .topbar,
  .sidebar,
  .menu-backdrop,
  .no-print,
  .back-home,
  .customer-back,
  .tab-page:not(#tab-client-summary):not(#tab-seller-summary),
  .summary-print:not(.active) {
    display: none !important;
  }

  #ownerView,
  .workspace,
  .content,
  #tab-client-summary.active,
  #tab-seller-summary.active {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #tab-client-summary .summary-sheet,
  #tab-seller-summary .summary-sheet {
    display: grid !important;
    gap: 7px !important;
    background: #fff !important;
    border: 0 !important;
    padding: 0 !important;
  }

  #tab-client-summary .summary-title,
  #tab-seller-summary .summary-title {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 0 2px !important;
    padding: 0 !important;
  }

  #tab-client-summary .summary-title img,
  #tab-seller-summary .summary-title img {
    width: 32px !important;
    height: 32px !important;
  }

  #tab-client-summary .summary-title h1,
  #tab-seller-summary .summary-title h1 {
    font-size: 22px !important;
    line-height: 1 !important;
    margin: 0 !important;
  }

  #tab-client-summary .summary-title p,
  #tab-seller-summary .summary-title p {
    font-size: 11px !important;
    line-height: 1.1 !important;
    margin: 2px 0 0 !important;
  }

  #tab-client-summary .client-summary-grid {
    display: grid !important;
    grid-template-columns: 1.45fr .8fr .9fr .85fr .8fr .75fr !important;
    gap: 4px !important;
  }

  #tab-seller-summary .seller-summary-grid {
    display: grid !important;
    grid-template-columns: 1.25fr .7fr .75fr .85fr 1fr 1fr !important;
    gap: 4px !important;
  }

  #tab-client-summary .client-summary-grid div,
  #tab-seller-summary .seller-summary-grid div {
    padding: 4px 6px !important;
    min-height: 0 !important;
    border: 1px solid #777 !important;
    border-radius: 4px !important;
  }

  #tab-client-summary .client-summary-grid span,
  #tab-seller-summary .seller-summary-grid span {
    display: block !important;
    font-size: 9px !important;
    line-height: 1 !important;
    color: #555 !important;
  }

  #tab-client-summary .client-summary-grid strong,
  #tab-seller-summary .seller-summary-grid strong {
    display: block !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
    margin-top: 1px !important;
    color: #111 !important;
  }

  #tab-client-summary .table-wrap,
  #tab-seller-summary .table-wrap {
    overflow: visible !important;
    background: #fff !important;
    border: 0 !important;
  }

  #tab-client-summary table,
  #tab-seller-summary table {
    display: table !important;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: 10px !important;
  }

  #tab-client-summary thead,
  #tab-seller-summary thead {
    display: table-header-group !important;
  }

  #tab-client-summary tbody,
  #tab-seller-summary tbody {
    display: table-row-group !important;
  }

  #tab-client-summary tr,
  #tab-seller-summary tr {
    display: table-row !important;
    box-shadow: none !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #tab-client-summary tr::after,
  #tab-seller-summary tr::after {
    content: none !important;
    display: none !important;
  }

  #tab-client-summary th,
  #tab-client-summary td,
  #tab-seller-summary th,
  #tab-seller-summary td {
    display: table-cell !important;
    border: 1px solid #d0d0d0 !important;
    padding: 5px 6px !important;
    color: #111 !important;
    text-align: left !important;
    vertical-align: top !important;
  }

  #tab-client-summary th,
  #tab-seller-summary th {
    font-size: 11px !important;
    font-weight: 800 !important;
    background: #f1f1f1 !important;
  }

  #tab-client-summary td::before,
  #tab-seller-summary td::before {
    content: none !important;
  }

  #clientSummaryTable th:nth-child(1),
  #clientSummaryTable td:nth-child(1) {
    width: 76px !important;
    white-space: nowrap !important;
  }

  #clientSummaryTable th:nth-child(2),
  #clientSummaryTable td:nth-child(2) {
    width: auto !important;
    white-space: normal !important;
  }

  #clientSummaryTable th:nth-child(3),
  #clientSummaryTable td:nth-child(3) {
    width: 64px !important;
    text-align: center !important;
  }

  #clientSummaryTable th:nth-child(4),
  #clientSummaryTable td:nth-child(4),
  #clientSummaryTable th:nth-child(5),
  #clientSummaryTable td:nth-child(5),
  #clientSummaryTable th:nth-child(6),
  #clientSummaryTable td:nth-child(6),
  #clientSummaryTable th:nth-child(7),
#clientSummaryTable td:nth-child(7) {
    width: 72px !important;
    white-space: nowrap !important;
  }
}

/* Visibilidad definitiva del boton Sobre nosotros en el login. */
body.login-mode .session-actions {
  display: flex !important;
}

body.login-mode .about-login {
  display: inline-flex !important;
}

body:not(.login-mode) .about-login,
body.login-mode #menuToggle,
body.login-mode #logoutBtn {
  display: none !important;
}

/* Correccion final: quitar el margen lateral extra del formulario en movil. */
@media (max-width: 900px) {
  #loginView #loginForm.auth-panel,
  #loginView .login-order-card {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}
