:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-soft: #eff6ff;
  --color-sidebar: #172033;
  --color-sidebar-muted: #94a3b8;
  --color-sidebar-active: #263656;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-border: #dfe5ec;
  --color-surface: #ffffff;
  --color-canvas: #f4f7fb;
  --color-success: #166534;
  --color-danger: #991b1b;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 5%);
  --shadow-md: 0 10px 30px rgb(15 23 42 / 8%);
  background: var(--color-canvas);
  color: var(--color-text);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  max-width: 100%;
}

body {
  background: var(--color-canvas);
  line-height: 1.5;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

svg {
  display: block;
}

:focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: 3px;
}

.skip-link {
  background: var(--color-surface);
  border-radius: 0 0 .5rem .5rem;
  box-shadow: var(--shadow-md);
  color: var(--color-primary-dark);
  font-weight: 700;
  left: 1rem;
  padding: .75rem 1rem;
  position: fixed;
  top: -5rem;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 16.5rem minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}

.app-sidebar {
  background: var(--color-sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  left: 0;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
}

.brand {
  align-items: center;
  display: flex;
  gap: .75rem;
  min-height: 3.25rem;
  padding: .25rem .5rem 1.25rem;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  border-radius: .75rem;
  box-shadow: 0 6px 16px rgb(37 99 235 / 28%);
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1.15rem;
  font-weight: 800;
  height: 2.5rem;
  justify-content: center;
  width: 2.5rem;
}

.brand-copy {
  display: grid;
  line-height: 1.25;
  min-width: 0;
}

.brand-copy strong {
  color: #fff;
  font-size: 1rem;
  letter-spacing: -.01em;
}

.brand-copy small {
  color: var(--color-sidebar-muted);
  font-size: .75rem;
  margin-top: .15rem;
}

.nav-section-label {
  color: var(--color-sidebar-muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .11em;
  margin: .5rem .75rem .65rem;
  text-transform: uppercase;
}

.primary-nav ul {
  display: grid;
  gap: .2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.primary-nav a {
  align-items: center;
  border-radius: .6rem;
  color: #cbd5e1;
  display: flex;
  font-size: .9rem;
  font-weight: 550;
  gap: .8rem;
  min-height: 2.75rem;
  padding: .65rem .75rem;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}

.primary-nav a:hover {
  background: rgb(255 255 255 / 6%);
  color: #fff;
}

.primary-nav a.active {
  background: var(--color-sidebar-active);
  box-shadow: inset 3px 0 0 #60a5fa;
  color: #fff;
}

.nav-icon {
  flex: 0 0 auto;
  height: 1.25rem;
  width: 1.25rem;
}

.sidebar-note {
  align-items: center;
  border-top: 1px solid rgb(255 255 255 / 9%);
  color: var(--color-sidebar-muted);
  display: flex;
  font-size: .76rem;
  gap: .55rem;
  margin-top: auto;
  padding: 1rem .7rem .25rem;
}

.status-dot {
  background: #4ade80;
  border: 3px solid rgb(74 222 128 / 18%);
  border-radius: 50%;
  box-sizing: content-box;
  height: .45rem;
  width: .45rem;
}

.app-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  align-items: center;
  background: rgb(255 255 255 / 96%);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: 4.5rem;
  padding: .65rem clamp(1rem, 2.5vw, 2rem);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-start,
.session-area,
.user-summary {
  align-items: center;
  display: flex;
}

.topbar-start {
  min-width: 0;
}

.topbar-title {
  color: #475569;
  font-size: .9rem;
  font-weight: 650;
}

.session-area {
  gap: 1rem;
  min-width: 0;
}

.user-summary {
  gap: .65rem;
  min-width: 0;
}

.user-avatar {
  align-items: center;
  background: var(--color-primary-soft);
  border: 1px solid #bfdbfe;
  border-radius: 50%;
  color: var(--color-primary-dark);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: .82rem;
  font-weight: 800;
  height: 2.25rem;
  justify-content: center;
  width: 2.25rem;
}

.user-copy {
  display: grid;
  line-height: 1.25;
  max-width: 17rem;
  min-width: 0;
}

.user-copy small {
  color: var(--color-muted);
  font-size: .68rem;
}

.user-copy strong {
  font-size: .8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button,
.icon-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--color-border);
  color: #475569;
  display: inline-flex;
  justify-content: center;
}

.logout-button {
  border-radius: .55rem;
  font-size: .82rem;
  font-weight: 650;
  gap: .5rem;
  min-height: 2.6rem;
  padding: .55rem .8rem;
}

.logout-button:hover,
.icon-button:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--color-text);
}

.logout-button svg,
.secondary-button svg {
  height: 1.1rem;
  width: 1.1rem;
}

.icon-button {
  border-radius: .55rem;
  height: 2.75rem;
  padding: 0;
  width: 2.75rem;
}

.icon-button svg {
  height: 1.35rem;
  width: 1.35rem;
}

.menu-button {
  display: none;
  margin-right: .65rem;
}

.app-main {
  margin: 0 auto;
  max-width: 90rem;
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  width: 100%;
}

.page-heading {
  align-items: flex-end;
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.eyebrow {
  color: var(--color-primary);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  margin: 0 0 .35rem;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  color: #172033;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  letter-spacing: -.035em;
  margin: 0;
}

h2 {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  letter-spacing: -.02em;
  margin: 0;
}

.page-lead {
  color: var(--color-muted);
  font-size: .95rem;
  margin: .55rem 0 0;
}

.welcome-card {
  align-items: flex-start;
  background: linear-gradient(120deg, #eff6ff, #f8fbff);
  border: 1px solid #bfdbfe;
  border-radius: .9rem;
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: clamp(1.15rem, 2.5vw, 1.6rem);
}

.welcome-card p {
  color: #52627a;
  margin: .45rem 0 0;
  max-width: 55rem;
}

.welcome-icon,
.placeholder-icon {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid #bfdbfe;
  border-radius: .75rem;
  color: var(--color-primary);
  display: inline-flex;
  flex: 0 0 auto;
  height: 3rem;
  justify-content: center;
  width: 3rem;
}

.welcome-icon .nav-icon,
.placeholder-icon .nav-icon {
  height: 1.5rem;
  width: 1.5rem;
}

.section-heading {
  align-items: flex-end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-caption {
  color: var(--color-muted);
  font-size: .8rem;
}

.module-grid {
  display: grid;
  gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.module-card {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: .75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: .8rem;
  min-height: 5rem;
  min-width: 0;
  padding: .9rem;
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.module-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 8px 24px rgb(15 23 42 / 8%);
  transform: translateY(-1px);
}

.module-card-icon {
  align-items: center;
  background: var(--color-primary-soft);
  border-radius: .65rem;
  color: var(--color-primary);
  display: inline-flex;
  flex: 0 0 auto;
  height: 2.6rem;
  justify-content: center;
  width: 2.6rem;
}

.module-card-icon .nav-icon {
  height: 1.25rem;
  width: 1.25rem;
}

.module-card-copy {
  display: grid;
  min-width: 0;
}

.module-card-copy strong {
  font-size: .9rem;
}

.module-card-copy small {
  color: var(--color-muted);
  font-size: .72rem;
  margin-top: .1rem;
}

.module-arrow {
  color: #94a3b8;
  flex: 0 0 auto;
  height: 1rem;
  margin-left: auto;
  width: 1rem;
}

.status-badge {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  color: #9a3412;
  flex: 0 0 auto;
  font-size: .72rem;
  font-weight: 750;
  padding: .35rem .7rem;
}

.placeholder-card {
  align-items: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: .9rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1.15rem;
  padding: clamp(1.25rem, 3vw, 2rem);
}

.placeholder-card p {
  color: var(--color-muted);
  margin: .55rem 0 1.25rem;
  max-width: 46rem;
}

.primary-button,
.secondary-button {
  align-items: center;
  border-radius: .55rem;
  display: inline-flex;
  font-size: .9rem;
  font-weight: 700;
  justify-content: center;
  min-height: 2.75rem;
  padding: .65rem 1rem;
  text-decoration: none;
}

.primary-button {
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  color: #fff;
}

.primary-button:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.secondary-button {
  background: var(--color-surface);
  border: 1px solid #cbd5e1;
  color: #334155;
  gap: .5rem;
}

.secondary-button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.mobile-drawer {
  background: var(--color-sidebar);
  border: 0;
  color: #e2e8f0;
  height: 100dvh;
  inset: 0 auto 0 0;
  margin: 0;
  max-height: none;
  max-width: min(20rem, 88vw);
  overflow-y: auto;
  padding: 1.25rem 1rem;
  width: min(20rem, 88vw);
}

.mobile-drawer:popover-open {
  display: flex;
  flex-direction: column;
}

.mobile-drawer::backdrop {
  background: rgb(15 23 42 / 62%);
}

.mobile-drawer .primary-nav {
  flex: 1;
}

.drawer-close {
  border-color: rgb(255 255 255 / 14%);
  color: #e2e8f0;
  position: absolute;
  right: .9rem;
  top: .9rem;
}

.mobile-drawer .brand {
  padding-right: 3.25rem;
}

.auth-shell {
  background:
    radial-gradient(circle at top left, rgb(37 99 235 / 10%), transparent 34rem),
    var(--color-canvas);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.25rem;
}

.auth-main {
  align-items: center;
  display: flex;
  flex: 1;
  justify-content: center;
  width: 100%;
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  max-width: 27rem;
  padding: clamp(1.4rem, 5vw, 2rem);
  width: 100%;
}

.auth-brand {
  align-items: center;
  border-bottom: 1px solid #edf1f5;
  display: flex;
  gap: .75rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
}

.auth-brand > span:last-child {
  display: grid;
  line-height: 1.2;
}

.auth-brand strong {
  color: #172033;
  font-size: 1rem;
}

.auth-brand small {
  color: var(--color-muted);
  font-size: .72rem;
  margin-top: .2rem;
}

.auth-brand-mark {
  height: 2.65rem;
  width: 2.65rem;
}

.auth-heading {
  margin-bottom: 1.35rem;
}

.auth-heading p:last-child,
.error-card > p:not(.eyebrow) {
  color: var(--color-muted);
  margin: .55rem 0 0;
}

.auth-form {
  display: grid;
  gap: .65rem;
}

.auth-form label:not(.opcion-recordar) {
  color: #334155;
  font-size: .82rem;
  font-weight: 700;
  margin-top: .25rem;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
  background: #fff;
  border: 1px solid #b8c3d1;
  border-radius: .55rem;
  color: var(--color-text);
  font-size: 1rem;
  min-height: 3rem;
  padding: .7rem .8rem;
  width: 100%;
}

.auth-form input::placeholder {
  color: #94a3b8;
}

.auth-form input:hover {
  border-color: #8291a5;
}

.auth-form input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 14%);
  outline: 0;
}

.opcion-recordar {
  align-items: center;
  color: #475569;
  cursor: pointer;
  display: flex;
  font-size: .82rem;
  gap: .6rem;
  margin: .35rem 0 .55rem;
  min-height: 2.25rem;
}

.opcion-recordar input {
  accent-color: var(--color-primary);
  height: 1.1rem;
  width: 1.1rem;
}

.auth-form .primary-button {
  width: 100%;
}

.auth-help {
  border-top: 1px solid #edf1f5;
  color: var(--color-muted);
  font-size: .75rem;
  margin: 1.4rem 0 0;
  padding-top: 1rem;
  text-align: center;
}

.auth-footer {
  color: var(--color-muted);
  font-size: .72rem;
  padding-top: 1rem;
  text-align: center;
}

.error-card > .primary-button {
  margin-top: 1.35rem;
}

.mensaje-error,
.mensaje-exito {
  border: 1px solid transparent;
  border-radius: .55rem;
  font-size: .82rem;
  margin-bottom: 1rem;
  padding: .75rem .85rem;
}

.mensaje-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--color-danger);
}

.mensaje-exito {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: var(--color-success);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.heading-actions,
.form-actions,
.search-actions,
.entity-card-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.search-panel,
.form-panel,
.data-panel,
.info-card,
.history-panel,
.empty-state,
.error-state {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: .85rem;
  box-shadow: var(--shadow-sm);
}

.search-panel {
  align-items: flex-end;
  display: flex;
  gap: .8rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
}

.search-field {
  flex: 1 1 20rem;
  min-width: 0;
}

.search-field label,
.form-field label {
  color: #334155;
  display: block;
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: .4rem;
}

.search-field input,
.form-field input,
.form-field textarea,
.form-field select {
  background: #fff;
  border: 1px solid #b8c3d1;
  border-radius: .55rem;
  box-sizing: border-box;
  color: var(--color-text);
  max-width: 100%;
  min-height: 2.85rem;
  min-width: 0;
  padding: .65rem .75rem;
  width: 100%;
}

/* El control nativo de fecha debe respetar el ancho disponible, también en WebKit. */
.form-field input[type="date"] {
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
}

.form-field input[type="date"]::-webkit-datetime-edit {
  min-width: 0;
  padding: 0;
}

.form-field input[type="date"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

/* iOS suma el padding del control date al 100% aun con border-box.
   Mantener el espacio en su contenido interno, sin alterar el picker nativo.
   https://bugs.webkit.org/show_bug.cgi?id=301648 */
@supports (-webkit-touch-callout: none) {
  .form-field input[type="date"] {
    padding-inline: 0;
  }

  .form-field input[type="date"]::-webkit-date-and-time-value {
    box-sizing: border-box;
    max-inline-size: 100%;
    padding-inline: .75rem;
  }
}

.form-field textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.search-field input:hover,
.form-field input:hover,
.form-field textarea:hover,
.form-field select:hover {
  border-color: #8291a5;
}

.search-field input:focus,
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 14%);
  outline: 0;
}

.form-panel {
  max-width: 58rem;
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.5rem);
  width: 100%;
}

.entity-form {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

/* No dejar que el tamaño intrínseco de inputs/selects ensanche el formulario. */
.entity-form > *,
.form-grid > *,
.catalog-warning > * {
  max-width: 100%;
  min-width: 0;
}

.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-field {
  max-width: 100%;
  min-width: 0;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.form-field .validation-message,
.validation-summary {
  color: var(--color-danger);
  font-size: .78rem;
}

.form-field .validation-message {
  display: block;
  margin-top: .3rem;
}

.validation-summary ul {
  margin: 0;
  padding-left: 1.15rem;
}

.validation-summary:empty {
  display: none;
}

.required-note,
.info-help {
  color: var(--color-muted);
  font-size: .76rem;
  margin: 0;
}

.field-help,
.entity-card-subtitle,
.price-caption,
.table-secondary {
  color: var(--color-muted);
  font-size: .76rem;
}

.field-help,
.entity-card-subtitle,
.price-caption {
  margin: .3rem 0 0;
}

.catalog-warning {
  align-items: center;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: .65rem;
  color: #92400e;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: .85rem;
}

.catalog-warning p {
  margin: .2rem 0 0;
}

.alert-with-action {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.inline-button {
  background: transparent;
  border: 0;
  color: inherit;
  font-weight: 750;
  padding: .2rem;
  text-decoration: underline;
}

.loading-state,
.empty-state,
.error-state {
  color: var(--color-muted);
  padding: 2rem;
  text-align: center;
}

.loading-state {
  align-items: center;
  display: flex;
  gap: .75rem;
  justify-content: center;
}

.spinner {
  animation: client-spinner .8s linear infinite;
  border: 3px solid #bfdbfe;
  border-radius: 50%;
  border-top-color: var(--color-primary);
  height: 1.35rem;
  width: 1.35rem;
}

@keyframes client-spinner {
  to {
    transform: rotate(360deg);
  }
}

.empty-state,
.error-state {
  display: grid;
  justify-items: center;
}

.empty-state p,
.error-state p {
  margin: .5rem 0 1.15rem;
}

.empty-state-icon {
  align-items: center;
  background: var(--color-primary-soft);
  border-radius: 50%;
  color: var(--color-primary);
  display: inline-flex;
  height: 3.25rem;
  justify-content: center;
  margin-bottom: .85rem;
  width: 3.25rem;
}

.empty-state-icon .nav-icon {
  height: 1.5rem;
  width: 1.5rem;
}

.data-panel {
  overflow: hidden;
}

.data-panel-heading,
.history-panel-heading {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.1rem;
}

.data-panel-heading > span {
  color: var(--color-muted);
  font-size: .8rem;
}

.desktop-table {
  overflow-x: auto;
  width: 100%;
}

/* Contenido variable: los códigos y nombres no deben ensanchar el viewport. */
.page-heading > *,
.entity-card-heading > *,
.order-detail-heading > *,
.reservation-card > *,
.timeline-heading > *,
.data-panel-heading > *,
.form-actions > *,
.info-card,
.entity-card,
.order-detail-item,
.sale-line-editor {
  min-width: 0;
  max-width: 100%;
}

h3,
strong,
dd,
.code-value,
.table-secondary,
.contact-link,
.table-action {
  overflow-wrap: anywhere;
}

.data-table td {
  overflow-wrap: anywhere;
}

input,
select,
textarea {
  min-width: 0;
  max-width: 100%;
}

.primary-button,
.secondary-button,
.danger-button {
  max-width: 100%;
  white-space: normal;
  text-align: center;
}

.table-action,
.button-link,
.inline-button {
  align-items: center;
  display: inline-flex;
  min-height: 2.75rem;
}

.data-table {
  border-collapse: collapse;
  width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #edf1f5;
  padding: .85rem 1.1rem;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: #f8fafc;
  color: #475569;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.numeric-cell {
  text-align: right !important;
  white-space: nowrap;
}

.actions-cell {
  text-align: right !important;
  white-space: nowrap;
}

.table-action {
  color: var(--color-primary-dark);
  font-size: .82rem;
  font-weight: 700;
  margin-left: .85rem;
  text-decoration: none;
}

.table-action:hover,
.contact-link:hover {
  text-decoration: underline;
}

.table-secondary {
  display: block;
  margin-top: .2rem;
}

.code-value {
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .82rem;
  font-weight: 700;
}

.reference-price,
.reference-price-hero {
  color: var(--color-primary-dark);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  white-space: nowrap;
}

.price-caption {
  text-align: right;
}

.balance-value,
.balance-hero,
.transaction-amount {
  color: #0f766e;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  white-space: nowrap;
}

.mobile-card-list {
  display: none;
}

.entity-card {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  padding: 1rem;
}

.entity-card:last-child {
  border-bottom: 0;
}

.entity-card-heading {
  align-items: flex-start;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
}

.entity-card h3,
.history-panel h3 {
  color: #172033;
  font-size: 1rem;
  margin: 0;
}

.contact-link {
  color: var(--color-primary-dark);
  display: inline-block;
  font-size: .86rem;
  margin-top: .2rem;
  text-decoration: none;
}

.entity-card-actions {
  border-top: 1px solid #edf1f5;
  margin-top: .85rem;
  padding-top: .85rem;
}

.entity-card-actions .secondary-button {
  flex: 1 1 7rem;
}

.detail-heading {
  align-items: center;
}

.customer-summary {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(15rem, .7fr) minmax(0, 1.3fr);
  margin-bottom: 1.75rem;
}

.info-card {
  padding: 1.25rem;
}

.product-summary {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(15rem, .7fr) minmax(0, 1.3fr);
  margin-bottom: 1.75rem;
}

.product-attributes-card {
  grid-column: 1 / -1;
}

.reference-card {
  background: linear-gradient(130deg, #eff6ff, #fff);
  border-color: #bfdbfe;
}

.reference-card .info-label {
  color: var(--color-primary-dark);
}

.reference-price-hero {
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  margin: .35rem 0;
}

.entity-card h3 {
  margin-top: .3rem;
}

.balance-card {
  background: linear-gradient(130deg, #f0fdfa, #fff);
  border-color: #99f6e4;
}

.info-label {
  color: #0f766e;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  margin: 0;
  text-transform: uppercase;
}

.balance-hero {
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  margin: .35rem 0;
}

.details-list {
  display: grid;
  gap: .9rem;
  margin: 1rem 0 0;
}

.details-list div {
  display: grid;
  gap: .15rem;
  grid-template-columns: minmax(6rem, .35fr) minmax(0, 1fr);
}

.details-list dt {
  color: var(--color-muted);
  font-size: .78rem;
  font-weight: 700;
}

.details-list dd {
  margin: 0;
}

.preserve-lines {
  white-space: pre-line;
}

.history-grid {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.history-panel {
  overflow: hidden;
}

.count-badge {
  align-items: center;
  background: #e2e8f0;
  border-radius: 999px;
  color: #475569;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 800;
  height: 1.65rem;
  justify-content: center;
  min-width: 1.65rem;
  padding: 0 .45rem;
}

.compact-empty {
  color: var(--color-muted);
  font-size: .85rem;
  margin: 0;
  padding: 1.2rem;
}

.timeline-list {
  display: grid;
}

.timeline-item {
  border-bottom: 1px solid #edf1f5;
  padding: 1rem;
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-heading {
  align-items: flex-start;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
}

.timeline-heading > div {
  display: grid;
}

.timeline-heading time {
  color: var(--color-muted);
  font-size: .75rem;
  margin-top: .12rem;
}

.status-badge-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: var(--color-success);
}

.status-badge-neutral {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.status-badge-payment {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--color-primary-dark);
}

.transaction-amount {
  font-size: 1.1rem;
  margin: .65rem 0 .35rem;
}

.payment-amount {
  color: var(--color-primary-dark);
}

.transaction-note,
.transaction-meta {
  color: var(--color-muted);
  font-size: .8rem;
  margin: .35rem 0 0;
}

.transaction-meta span {
  font-weight: 700;
}

.transaction-details {
  border-top: 1px dashed #d8e0e8;
  display: grid;
  gap: .35rem;
  list-style: none;
  margin: .75rem 0 0;
  padding: .65rem 0 0;
}

.transaction-details li {
  align-items: baseline;
  display: flex;
  font-size: .78rem;
  gap: .75rem;
  justify-content: space-between;
}

.transaction-details span {
  color: var(--color-muted);
  min-width: 0;
  overflow-wrap: anywhere;
}

.transaction-details strong {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 62rem) {
  .topbar-title {
    display: none;
  }

  .user-copy {
    max-width: 11rem;
  }
}

@media (max-width: 64rem) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    display: none;
  }

  .menu-button {
    display: inline-flex;
  }

  .topbar {
    min-height: 4rem;
    padding: .55rem .75rem;
  }

  .session-area {
    gap: .5rem;
  }

  .user-avatar {
    height: 2rem;
    width: 2rem;
  }

  .user-copy {
    max-width: min(32vw, 8.5rem);
  }

  .user-copy small {
    display: none;
  }

  .app-main {
    padding: 1.25rem 1rem 2rem;
  }

  .page-heading {
    align-items: flex-start;
  }

  .welcome-card,
  .placeholder-card {
    gap: .85rem;
  }

  .section-caption {
    display: none;
  }
}

@media (max-width: 30rem) {
  .logout-button {
    height: 2.65rem;
    padding: 0;
    width: 2.65rem;
  }

  .logout-button span {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }

  .user-copy {
    max-width: 6.5rem;
  }

  .welcome-card,
  .placeholder-card {
    display: grid;
  }

  .placeholder-icon,
  .welcome-icon {
    height: 2.75rem;
    width: 2.75rem;
  }

  .auth-shell {
    padding: .75rem;
  }

  .auth-card {
    border-radius: .8rem;
  }
}

/* Compras, proveedores y comprobantes */
.purchase-desktop-table .status-badge {
  white-space: nowrap;
}

.purchase-origin-import {
  background: #eff6ff;
  color: #1d4ed8;
}

.purchase-origin-received {
  background: #ecfdf5;
  color: #047857;
}

.purchase-origin-catalog {
  background: #fff7ed;
  color: #c2410c;
}

.receipt-indicator {
  border-radius: 999px;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 750;
  padding: .3rem .55rem;
}

.receipt-attached {
  background: #ecfdf5;
  color: #047857;
}

.receipt-missing {
  background: #f1f5f9;
  color: #64748b;
}

.provider-card .inventory-card-details,
.purchase-card .inventory-card-details {
  margin-top: .9rem;
}

.purchase-form-panel {
  max-width: none;
}

.purchase-lines-editor > .data-panel-heading {
  flex-wrap: wrap;
  gap: .75rem;
}

.purchase-lines-editor > .data-panel-heading > div {
  flex: 1 1 16rem;
}

.purchase-lines-editor > .data-panel-heading > button {
  flex: 0 1 auto;
}

.purchase-lines-editor .order-line-heading {
  flex-wrap: wrap;
}

.purchase-line-grid > *,
.purchase-lines-editor .order-line-heading > *,
.origin-guidance > *,
.receipt-upload-heading > *,
.purchase-total-preview > * {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.field-help-link {
  color: var(--color-primary-dark);
  display: inline-block;
  text-decoration: none;
}

.field-help-link:hover {
  text-decoration: underline;
}

.origin-guidance,
.purchase-reception-note {
  align-items: center;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: .7rem;
  color: #1e3a8a;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  padding: .85rem 1rem;
}

.origin-guidance {
  align-items: flex-start;
  justify-content: flex-start;
}

.origin-guidance span {
  font-size: .82rem;
}

.catalog-origin-guidance {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.purchase-line-grid {
  align-items: end;
  display: grid;
  gap: .75rem;
  grid-template-columns: minmax(0, 2fr) minmax(0, .55fr) minmax(0, .8fr) minmax(0, .7fr);
}

.purchase-line-subtotal {
  align-content: center;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: .55rem;
  display: grid;
  min-height: 2.85rem;
  padding: .45rem .7rem;
  text-align: right;
}

.purchase-line-subtotal span,
.purchase-total-preview span {
  color: var(--color-muted);
  font-size: .7rem;
}

.purchase-line-subtotal strong,
.purchase-total-preview strong {
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}

.purchase-total-preview {
  align-items: center;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: .7rem;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding: .8rem 1rem;
}

.purchase-total-preview strong {
  font-size: 1.25rem;
}

.receipt-upload-panel {
  border: 1px solid var(--color-border);
  border-radius: .8rem;
  overflow: hidden;
}

.receipt-upload-heading {
  align-items: center;
  background: #f8fafc;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem;
}

.receipt-upload-heading h2,
.receipt-detail h2 {
  color: #172033;
  font-size: 1.05rem;
  margin: 0;
}

.receipt-upload-heading p,
.receipt-detail .data-panel-heading p,
.purchase-reception-note p {
  color: var(--color-muted);
  font-size: .78rem;
  margin: .3rem 0 0;
}

.receipt-toggle {
  align-items: center;
  color: #334155;
  display: inline-flex;
  font-size: .82rem;
  font-weight: 750;
  gap: .5rem;
  white-space: nowrap;
}

.receipt-toggle input {
  accent-color: var(--color-primary);
  height: 1.05rem;
  width: 1.05rem;
}

.receipt-upload-body {
  border-top: 1px solid var(--color-border);
  padding: 1rem;
}

.selected-file {
  align-items: center;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: .55rem;
  color: #065f46;
  display: flex;
  font-size: .78rem;
  gap: .75rem;
  justify-content: space-between;
  margin: .55rem 0 0;
  overflow-wrap: anywhere;
  padding: .65rem .75rem;
}

.purchase-summary {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1.25rem;
}

.purchase-summary .info-card {
  display: grid;
  gap: .35rem;
}

.purchase-summary .status-badge {
  justify-self: start;
}

.purchase-reception-note,
.purchase-notes,
.purchase-detail-panel {
  margin-bottom: 1.25rem;
}

.purchase-notes p {
  margin: .5rem 0 0;
  overflow-wrap: anywhere;
}

.receipt-detail {
  padding: 0;
}

.receipt-detail .data-panel-heading {
  border-bottom: 1px solid var(--color-border);
}

.receipt-detail .mensaje-error,
.receipt-empty {
  margin: 1rem;
}

.receipt-empty {
  color: var(--color-muted);
}

.receipt-values {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 1rem 1.1rem;
}

.receipt-values div {
  display: grid;
  gap: .25rem;
}

.receipt-values dt {
  color: var(--color-muted);
  font-size: .72rem;
}

.receipt-values dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 64rem) {
  .purchase-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-product-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 47.99rem) {
  .purchase-summary,
  .purchase-line-grid,
  .receipt-values {
    grid-template-columns: minmax(0, 1fr);
  }

  .purchase-product-field {
    grid-column: auto;
  }

  .receipt-upload-heading,
  .purchase-reception-note,
  .purchase-lines-editor > .data-panel-heading {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .purchase-lines-editor > .data-panel-heading > button {
    justify-self: start;
  }

  .receipt-toggle {
    min-height: 2.5rem;
  }
}

@media (max-width: 30rem) {
  .purchase-submit-actions > *,
  .receipt-detail .primary-button {
    flex: 1 1 100%;
    width: 100%;
  }

  .selected-file,
  .purchase-total-preview {
    align-items: flex-start;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 64rem) {
  .page-heading,
  .detail-heading {
    display: grid;
  }

  .page-heading > .primary-button,
  .heading-actions {
    width: 100%;
  }

  .heading-actions > a {
    flex: 1 1 8rem;
  }

  .search-panel {
    align-items: stretch;
    display: grid;
  }

  .search-actions > button {
    flex: 1 1 7rem;
  }

  .form-grid,
  .customer-summary,
  .history-grid,
  .product-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .desktop-table {
    display: none;
  }

  .mobile-card-list {
    display: block;
  }

  .details-list div {
    grid-template-columns: minmax(5.5rem, .4fr) minmax(0, 1fr);
  }

  .product-attributes-card {
    grid-column: auto;
  }

  .catalog-warning {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .alert-with-action {
    align-items: flex-start;
    display: grid;
  }
}

@media (max-width: 30rem) {
  .form-actions > .primary-button,
  .form-actions > .secondary-button {
    flex: 1 1 100%;
  }

  .entity-card-heading {
    display: grid;
  }

  .details-list div {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .timeline-heading {
    align-items: flex-start;
  }

  .status-badge {
    white-space: nowrap;
  }
}


@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
.inventory-state-filter {
  flex: 0 1 15rem;
}

.inventory-reception {
  align-items: end;
  background: linear-gradient(130deg, #eff6ff, #fff);
  border: 1px solid #bfdbfe;
  border-radius: .85rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding: 1rem;
}

.inventory-reception h2 {
  font-size: 1.05rem;
}

.inventory-reception p:not(.eyebrow) {
  color: var(--color-muted);
  font-size: .8rem;
  margin: .35rem 0 0;
  max-width: 42rem;
}

.reception-controls {
  align-items: end;
  display: flex;
  flex: 0 0 auto;
  gap: .65rem;
}

.reception-controls .form-field {
  min-width: 10.5rem;
}

.inventory-badge-group {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.inventory-badge {
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1.2;
  padding: .32rem .58rem;
  white-space: nowrap;
}

.inventory-status-purchased {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.inventory-status-transit {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.inventory-status-available {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.inventory-status-sold {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.inventory-status-delivered {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.inventory-status-lost {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.inventory-status-neutral,
.no-reservation-badge {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}

.reservation-badge {
  background: #fefce8;
  border-color: #fde68a;
  color: #a16207;
}

.inventory-actions-cell {
  min-width: 9.5rem;
}

.reception-check {
  align-items: center;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  font-size: .78rem;
  font-weight: 700;
  gap: .4rem;
  justify-content: flex-end;
  min-height: 2rem;
  white-space: nowrap;
}

.reception-check input {
  accent-color: var(--color-primary);
  height: 1rem;
  width: 1rem;
}

.button-link {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: .3rem 0;
}

.button-link:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.inventory-card-details {
  display: grid;
  gap: .5rem;
  margin: .9rem 0 0;
}

.inventory-card-details div {
  display: grid;
  gap: .15rem;
  grid-template-columns: 7rem minmax(0, 1fr);
}

.inventory-card-details dt {
  color: var(--color-muted);
  font-size: .73rem;
  font-weight: 700;
}

.inventory-card-details dd {
  font-size: .8rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.inventory-card-actions {
  align-items: stretch;
  display: grid;
}

.mobile-reception-check {
  justify-content: flex-start;
  min-height: 2.75rem;
}

@media (max-width: 47.99rem) {
  .inventory-reception {
    align-items: stretch;
    display: grid;
  }

  .reception-controls {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 30rem) {
  .reception-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .inventory-badge-group {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .inventory-card-details div {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Pedidos y reservas */
.danger-button {
  align-items: center;
  background: #fff;
  border: 1px solid #fca5a5;
  border-radius: .55rem;
  color: var(--color-danger);
  display: inline-flex;
  font-size: .9rem;
  font-weight: 700;
  justify-content: center;
  min-height: 2.75rem;
  padding: .65rem 1rem;
}

.danger-button:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

.danger-button:disabled,
.button-link:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.order-status {
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.2;
  padding: .35rem .65rem;
  white-space: nowrap;
}

.order-status-pending {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.order-status-confirmed {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.order-status-canceled {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.order-status-completed {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.order-table .code-value,
.order-card .code-value {
  display: block;
}

.order-form-panel {
  max-width: none;
}

.order-lines-editor {
  border-top: 1px solid var(--color-border);
  margin-top: 1.5rem;
  padding-top: 1.25rem;
}

.order-lines-editor .data-panel-heading,
.order-detail-panel .data-panel-heading {
  padding: 0 0 1rem;
}

.order-lines-editor .data-panel-heading p,
.order-detail-panel .data-panel-heading p,
.add-order-line-body > p {
  color: var(--color-muted);
  font-size: .8rem;
  margin: .35rem 0 0;
}

.order-lines-list,
.order-detail-list {
  display: grid;
  gap: .85rem;
  grid-template-columns: minmax(0, 1fr);
  padding-top: 1rem;
}

.order-line-editor,
.order-detail-item {
  background: #fbfdff;
  border: 1px solid var(--color-border);
  border-radius: .7rem;
  min-width: 0;
  padding: 1rem;
}

.order-line-heading,
.order-detail-heading,
.reservation-heading,
.reservation-card {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.order-line-heading {
  margin-bottom: .85rem;
}

.order-line-heading h3,
.order-detail-heading h3,
.reservation-heading h4 {
  margin: 0;
}

.order-line-heading h3,
.order-detail-heading h3 {
  color: #172033;
  font-size: .95rem;
}

.order-line-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: minmax(12rem, 2fr) minmax(6.5rem, .65fr) minmax(8rem, .8fr) minmax(10rem, 1.25fr);
}

.order-summary {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 2fr) minmax(15rem, .75fr);
  margin-bottom: 1.25rem;
}

.order-total-card {
  align-content: start;
  display: grid;
}

.order-total-card > strong {
  color: #172033;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.order-total-card > span,
.order-total-card > p:not(.eyebrow) {
  color: var(--color-muted);
  font-size: .78rem;
  margin: .35rem 0 0;
}

.order-detail-panel {
  margin-bottom: 1.25rem;
  padding: 1rem;
}

.order-detail-heading {
  align-items: flex-start;
  border-bottom: 1px solid #e8edf3;
  padding-bottom: .8rem;
}

.order-detail-heading p {
  color: var(--color-muted);
  font-size: .78rem;
  margin: .25rem 0 0;
}

.order-detail-number {
  color: var(--color-primary);
  display: block;
  font-size: .68rem;
  font-weight: 800;
  margin-bottom: .2rem;
  text-transform: uppercase;
}

.order-detail-values {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: .8rem 0 0;
}

.order-detail-values div {
  display: grid;
  gap: .15rem;
}

.order-detail-values dt,
.reservation-card span {
  color: var(--color-muted);
  font-size: .72rem;
}

.order-detail-values dd {
  font-size: .85rem;
  font-weight: 700;
  margin: 0;
}

.reservation-section {
  border-top: 1px dashed #d8e0e8;
  margin-top: .9rem;
  padding-top: .9rem;
}

.reservation-heading h4 {
  color: #334155;
  font-size: .85rem;
}

.reservation-heading span {
  color: var(--color-muted);
  font-size: .75rem;
}

.reservation-list {
  display: grid;
  gap: .55rem;
  margin-top: .65rem;
}

.reservation-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: .6rem;
  padding: .65rem .75rem;
}

.reservation-card > div:first-child {
  display: grid;
}

.reservation-empty,
.reservation-complete {
  color: var(--color-muted);
  font-size: .78rem;
  margin: .65rem 0 0;
}

.reservation-complete {
  color: var(--color-success);
  font-weight: 700;
}

.reservation-picker {
  align-items: end;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: .65rem;
  display: grid;
  gap: .65rem;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: .75rem;
  padding: .75rem;
}

.add-order-line {
  padding: 0;
}

.add-order-line summary {
  color: #172033;
  cursor: pointer;
  font-weight: 750;
  padding: 1rem;
}

.add-order-line-body {
  border-top: 1px solid var(--color-border);
  padding: 1rem;
}

@media (max-width: 64rem) {
  .order-line-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-product-field,
  .order-line-note {
    grid-column: 1 / -1;
  }
}

@media (max-width: 47.99rem) {
  .order-summary,
  .order-line-grid,
  .order-detail-values {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-product-field,
  .order-line-note {
    grid-column: auto;
  }

  .order-detail-heading,
  .reservation-card {
    align-items: flex-start;
  }

  .reservation-card {
    flex-wrap: wrap;
  }

  .reservation-card > .button-link {
    flex: 1 1 100%;
    min-height: 2.5rem;
    text-align: left;
  }
}

@media (max-width: 30rem) {
  .heading-actions > .danger-button,
  .reservation-picker > .primary-button {
    width: 100%;
  }

  .reservation-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .order-line-editor,
  .order-detail-item,
  .order-detail-panel {
    padding: .75rem;
  }
}

/* Ventas y pagos */
.sale-status-registered {
  background: #ecfdf5;
  color: #047857;
}

.sale-status-canceled {
  background: #fef2f2;
  color: #b91c1c;
}

.sale-card-total,
.sale-mobile-total {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.sale-card-total {
  border-top: 1px solid #edf1f5;
  margin-top: .85rem;
  padding-top: .85rem;
}

.sale-card-total span,
.sale-mobile-total span {
  color: var(--color-muted);
  font-size: .8rem;
}

.sale-card-total strong,
.sale-mobile-total strong {
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}

.sale-summary,
.sale-origin-summary {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1.25rem;
}

.sale-origin-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sale-summary .info-card,
.sale-origin-summary .info-card {
  display: grid;
  gap: .35rem;
}

.sale-summary .status-badge {
  justify-self: start;
  margin-top: .35rem;
}

.sale-notes {
  margin-bottom: 1.25rem;
}

.sale-notes p {
  margin: .5rem 0 0;
  overflow-wrap: anywhere;
}

.sale-detail-panel,
.sale-lines-panel,
.payment-history {
  margin-top: 1.25rem;
}

.sale-detail-values {
  display: grid;
  gap: .65rem;
  margin: .85rem 0 0;
}

.sale-detail-values div {
  display: grid;
  gap: .2rem;
  min-width: 0;
}

.sale-detail-values dt {
  color: var(--color-muted);
  font-size: .72rem;
}

.sale-detail-values dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.sale-mobile-total {
  background: #f8fafc;
  border-top: 1px solid var(--color-border);
  gap: .75rem;
  padding: 1rem;
}

.sale-order-picker,
.payment-customer-picker {
  margin-bottom: 1.25rem;
  max-width: none;
}

.sale-order-picker .data-panel-heading {
  border: 0;
  padding: 0 0 1rem;
}

.data-panel-heading p {
  color: var(--color-muted);
  font-size: .78rem;
  margin: .25rem 0 0;
}

.sale-empty-orders {
  margin-top: 1.25rem;
}

.sale-form {
  gap: 1.25rem;
}

.sale-form > .form-panel {
  max-width: none;
}

.sale-lines-panel {
  margin-top: 0;
}

.sale-lines-list {
  display: grid;
}

.sale-line-editor {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.1rem;
}

.sale-line-editor:last-child {
  border-bottom: 0;
}

.sale-line-heading {
  align-items: flex-start;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
}

.sale-line-heading h3 {
  color: #172033;
  font-size: 1rem;
  margin: 0;
}

.sale-line-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: .9rem;
}

.sale-unit-field,
.sale-line-note {
  grid-column: span 1;
}

.sale-unit-warning,
.payment-no-debt {
  color: var(--color-danger);
}

.sale-submit-actions {
  padding-bottom: .5rem;
}

.payment-layout {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(18rem, .75fr) minmax(0, 1.25fr);
}

.payment-balance-card {
  display: grid;
  gap: .35rem;
  margin-bottom: 1.25rem;
}

.payment-balance-card h2 {
  font-size: 1.05rem;
  margin: 0;
}

.payment-form-panel {
  max-width: none;
}

.payment-form-panel > h2 {
  font-size: 1.1rem;
  margin: 0 0 1rem;
}

.payment-history {
  margin-top: 0;
  min-width: 0;
}

.payment-history-empty {
  border: 0;
  box-shadow: none;
}

@media (max-width: 64rem) {
  .sale-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payment-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sale-line-grid,
  .sale-origin-summary,
  .order-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .sale-mode-selector,
  .direct-sale-intro,
  .direct-sale-partial-warning {
    flex-wrap: wrap;
  }
}

@media (max-width: 47.99rem) {
  .sale-summary,
  .sale-origin-summary,
  .sale-line-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sale-line-editor {
    padding: 1rem;
  }

  .sale-mobile-total {
    align-items: flex-start;
    display: grid;
  }

  .sale-order-link {
    margin-left: 0;
  }
}

@media (max-width: 30rem) {
  .sale-line-heading {
    display: grid;
  }

  .sale-submit-actions > *,
  .payment-form-panel .form-actions > * {
    flex: 1 1 100%;
    width: 100%;
  }

  .payment-customer-picker,
  .sale-order-picker,
  .sale-line-editor {
    padding-left: .75rem;
    padding-right: .75rem;
  }
}
.sale-mode-selector,
.direct-sale-intro {
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: .85rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding: 1rem;
}

.sale-mode-selector h2,
.direct-sale-intro h2 {
  font-size: 1.05rem;
}

.sale-mode-actions {
  display: flex;
  gap: .6rem;
}

.sale-mode-active {
  background: var(--color-primary-soft);
  border-color: #93c5fd;
  color: var(--color-primary-dark);
}

.direct-sale-intro {
  background: linear-gradient(130deg, #eff6ff, #fff);
  border-color: #bfdbfe;
}

.direct-sale-intro p:not(.eyebrow) {
  color: var(--color-muted);
  font-size: .8rem;
  margin: .35rem 0 0;
  max-width: 50rem;
}

.direct-sale-form {
  display: grid;
  gap: 1rem;
}

.direct-sale-units {
  padding: 0;
}

.direct-sale-units .data-panel-heading p {
  color: var(--color-muted);
  font-size: .78rem;
  margin: .3rem 0 0;
}

.direct-sale-price-field {
  min-width: 8rem;
}

.direct-sale-price-field input {
  min-height: 2.5rem;
}

.direct-sale-check {
  align-items: center;
  color: #334155;
  display: inline-flex;
  font-size: .78rem;
  font-weight: 700;
  gap: .4rem;
  min-height: 2.5rem;
}

.direct-sale-check input,
.direct-sale-desktop-table input[type="checkbox"] {
  accent-color: var(--color-primary);
  height: 1.05rem;
  width: 1.05rem;
}

.direct-sale-unit-card {
  display: grid;
  gap: .8rem;
}

.direct-sale-unit-card .inventory-badge-group {
  align-items: flex-start;
  flex-direction: row;
  flex-wrap: wrap;
}

.direct-sale-partial-warning {
  align-items: center;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: .75rem;
  color: #9a3412;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem;
}

.direct-sale-partial-warning h3 {
  font-size: .95rem;
  margin: 0;
}

.direct-sale-partial-warning p {
  font-size: .8rem;
  margin: .3rem 0 0;
  max-width: 55rem;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

@media (max-width: 47.99rem) {
  .sale-mode-selector,
  .direct-sale-intro,
  .direct-sale-partial-warning {
    align-items: stretch;
    display: grid;
  }

  .sale-mode-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .direct-sale-partial-warning > .secondary-button {
    width: 100%;
  }
}

@media (max-width: 30rem) {
  .sale-mode-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .direct-sale-intro .status-badge {
    justify-self: start;
  }
}

/* Dashboard */
.dashboard-heading {
  margin-bottom: .75rem;
}

.dashboard-summary-heading {
  font-size: 1rem;
  margin: 0 0 .65rem;
}

.dashboard-metrics {
  display: grid;
  gap: .65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: .75rem;
}

.dashboard-metric-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: .85rem;
  box-shadow: var(--shadow-sm);
  align-content: start;
  display: grid;
  gap: .35rem;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  padding: .8rem;
}

.dashboard-metric-card > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-metric-card a {
  align-items: center;
  color: var(--color-primary-dark);
  display: inline-flex;
  font-size: .76rem;
  line-height: 1.35;
  min-height: 2.75rem;
}

.dashboard-quick-actions {
  margin-bottom: 1rem;
}

.context-filter {
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.context-filter > span {
  flex: 1 1 14rem;
  min-width: 0;
}

.dashboard-action-grid {
  display: grid;
  gap: .65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-action-grid > a {
  min-width: 0;
  min-height: 5rem;
  font-size: 1.05rem;
  padding: .75rem;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 21rem) {
  .dashboard-action-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dashboard-debt-card {
  background: linear-gradient(135deg, #eff6ff, #fff);
  border-color: #bfdbfe;
}

.dashboard-metric-label {
  color: #475569;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .025em;
  line-height: 1.35;
  text-transform: uppercase;
}

.dashboard-metric-card strong {
  color: #172033;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.dashboard-metric-card small,
.dashboard-panel-heading p,
.dashboard-utility-status {
  color: var(--color-muted);
}

.dashboard-metric-card small {
  font-size: .76rem;
}

.dashboard-utility-panel,
.dashboard-channel-panel,
.dashboard-load-error {
  margin-bottom: 1.25rem;
}

.dashboard-utility-panel {
  min-width: 0;
  padding: 1rem;
}

.dashboard-utility-panel > .dashboard-panel-heading {
  border: 0;
  margin-bottom: .75rem;
  padding: 0;
}

.dashboard-utility-panel h2 {
  font-size: 1rem;
}

.dashboard-panel-heading {
  align-items: flex-start;
  gap: 1rem;
}

.dashboard-panel-heading p {
  font-size: .78rem;
  margin: .3rem 0 0;
}

.dashboard-period-form {
  align-items: end;
  display: grid;
  gap: .65rem;
  grid-template-columns: minmax(0, 1fr);
  max-width: 100%;
  min-width: 0;
}

.dashboard-period-form > * {
  max-width: 100%;
  min-width: 0;
}

.dashboard-period-form .primary-button {
  justify-self: end;
  min-height: 2.85rem;
}

.dashboard-utility-error {
  margin: .75rem 0 0;
}

.dashboard-utility-status {
  font-size: .85rem;
  margin: .75rem 0 0;
}

.dashboard-utility-result {
  border-top: 1px solid #99f6e4;
  display: grid;
  gap: .2rem;
  grid-template-columns: minmax(0, 1fr);
  margin-top: .75rem;
  padding-top: .75rem;
}

.dashboard-utility-result > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-utility-result span {
  color: #0f766e;
  font-size: .82rem;
  font-weight: 700;
}

.dashboard-utility-result strong {
  color: #115e59;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.dashboard-recent-grid {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 40rem), 1fr));
}

.dashboard-recent-panel {
  min-width: 0;
}

.dashboard-first-action {
  margin-left: 0;
}

.dashboard-compact-empty {
  padding: 1.5rem 1.1rem;
}

.dashboard-channel-card,
.dashboard-recent-card {
  margin-bottom: .75rem;
}

.dashboard-channel-card:last-child,
.dashboard-recent-card:last-child {
  margin-bottom: 0;
}

.dashboard-card-values {
  display: grid;
  gap: .65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: .9rem 0 0;
}

.dashboard-card-values div {
  background: #f8fafc;
  border-radius: .55rem;
  padding: .65rem;
}

.dashboard-card-values dt {
  color: var(--color-muted);
  font-size: .72rem;
  font-weight: 700;
}

.dashboard-card-values dd {
  font-size: 1rem;
  font-weight: 800;
  margin: .15rem 0 0;
}

.dashboard-customer-link,
.dashboard-recent-card h3 a {
  color: var(--color-primary-dark);
  font-weight: 700;
  text-decoration: none;
}

.dashboard-customer-link {
  display: inline-block;
  font-size: .84rem;
  margin-top: .75rem;
}

.dashboard-customer-link:hover,
.dashboard-recent-card h3 a:hover {
  text-decoration: underline;
}

@media (min-width: 48rem) {
  .dashboard-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-period-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }
}

@media (max-width: 47.99rem) {
  .dashboard-channel-cards,
  .dashboard-recent-cards {
    padding: .8rem;
  }
}

@media (max-width: 30rem) {
  .dashboard-panel-heading {
    align-items: flex-start;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-card-values {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 21rem) {
  .dashboard-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Reconexión: las clases y los contadores components-reconnect-* pertenecen a Blazor. */
#components-reconnect-modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  box-shadow: var(--shadow-md);
  color: var(--color-text);
  margin: auto;
  max-height: calc(100% - 2rem);
  max-width: calc(100% - 2rem);
  overflow-wrap: anywhere;
  padding: clamp(1.25rem, 4vw, 2rem);
  width: min(26rem, calc(100% - 2rem));
}

#components-reconnect-modal::backdrop {
  background: rgb(15 23 42 / 45%);
}

#components-reconnect-modal:not([open]),
#components-reconnect-modal .reconnect-state {
  display: none;
}

#components-reconnect-modal.components-reconnect-show .reconnect-state-show,
#components-reconnect-modal.components-reconnect-failed .reconnect-state-failed,
#components-reconnect-modal.components-reconnect-rejected .reconnect-state-rejected {
  display: grid;
  gap: 1rem;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

#components-reconnect-modal h2 {
  font-size: clamp(1.25rem, 4vw, 1.6rem);
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

#components-reconnect-modal p {
  font-size: 1rem;
  margin: 0;
}

#components-reconnect-modal .reconnect-attempts {
  color: var(--color-muted);
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
}

#components-reconnect-modal[data-manual-retry] .reconnect-attempts {
  display: none;
}

#components-reconnect-modal .primary-button {
  min-height: 2.85rem;
}

.reconnect-spinner {
  animation: reconnect-spin 1s linear infinite;
  border: .3rem solid #dbeafe;
  border-radius: 50%;
  border-top-color: var(--color-primary);
  height: 3.25rem;
  width: 3.25rem;
}

@keyframes reconnect-spin {
  to { transform: rotate(360deg); }
}

.history-month-toggle {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  min-height: 2.75rem;
  padding: .35rem 0;
  text-align: left;
  width: 100%;
}

.history-month-toggle:focus-visible {
  outline: 2px solid var(--color-primary, #2563eb);
  outline-offset: 2px;
}

.payment-history-body {
  min-width: 0;
  padding: 0 1.1rem 1.1rem;
}

.history-month-row th {
  background: #eff6ff;
  color: #1e3a8a;
  text-align: left;
  font-size: 1rem;
  padding-block: .85rem;
}

.history-month-title {
  grid-column: 1 / -1;
  margin: .75rem 0 0;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 1.05rem;
  color: #1e3a8a;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  .reconnect-spinner {
    animation: none;
  }
}
