:root {
  color-scheme: light;
  --bg: #f3f1ee;
  --surface: #ffffff;
  --surface-2: #f0ece8;
  --ink: #191919;
  --muted: #68615d;
  --line: #ded8d3;
  --primary: #b21f24;
  --primary-dark: #82171b;
  --danger: #b21f24;
  --warning: #ad6a00;
  --ready: #7a4b2d;
  --done: #496050;
  --shadow: 0 14px 34px rgba(28, 20, 17, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}

button,
.button-link {
  text-decoration: none;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(16px, 4vw, 38px);
  background:
    radial-gradient(circle at 8% 0%, rgba(178, 31, 36, 0.34), transparent 34%),
    linear-gradient(135deg, #080808 0%, #191313 100%);
  color: white;
  border-bottom: 4px solid var(--primary);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 280px;
}

.admin-logo {
  width: 118px;
  height: 76px;
  object-fit: contain;
}

.admin-brand-copy {
  display: grid;
  gap: 1px;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: #d8ceca;
  font-size: 13px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 4px;
  color: #efb7b9;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.top-actions,
.section-title,
.form-actions,
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions select {
  width: auto;
  min-width: 150px;
  background: white;
}

.online-order-alert {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px clamp(16px, 4vw, 38px);
  border-top: 1px solid #ffcc66;
  border-bottom: 3px solid #9e2a2a;
  background: #fff0d6;
  color: #641b1b;
  box-shadow: 0 8px 24px rgba(100, 27, 27, 0.2);
}

.online-order-alert[hidden] {
  display: none;
}

.online-order-alert-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: #b83232;
  color: white;
  font-size: 28px;
  font-weight: 900;
  animation: online-alert-pulse 1.8s ease-in-out infinite;
}

.online-order-alert-content {
  display: grid;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

.online-order-alert-content strong {
  font-size: 18px;
}

.online-order-alert-content span {
  font-size: 13px;
  font-weight: 700;
}

.online-order-alert button {
  flex: 0 0 auto;
  background: #b83232;
  color: white;
}

.online-order-alert button:hover {
  background: #8f2424;
  color: white;
}

@keyframes online-alert-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(184, 50, 50, 0.35); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(184, 50, 50, 0); }
}

.layout {
  display: grid;
  grid-template-columns: minmax(330px, 470px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 38px) 32px;
}

.module-view {
  display: none !important;
}

.module-view.active-module.layout {
  display: grid !important;
}

.module-view.active-module.delivery-module {
  display: block !important;
}

.module-view.active-module.customers-module {
  display: block !important;
}

.button-link[hidden] {
  display: none !important;
}

.module-view.active-module.documents-module {
  display: block !important;
}

.module-view.active-module.offers-studio-module {
  display: block !important;
}

.documents-module {
  padding: 18px clamp(16px, 4vw, 38px) 32px;
}

.documents-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.documents-head p {
  margin-bottom: 0;
}

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

.document-card {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.document-card h3,
.document-card p {
  margin: 0;
}

.document-status {
  min-height: 40px;
  color: var(--muted);
}

.document-list {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.document-row strong,
.document-row small {
  display: block;
}

.document-row strong {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.document-row-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.document-row-actions button:disabled {
  cursor: default;
  opacity: 0.35;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.form-panel {
  align-self: start;
  padding: 18px;
  position: sticky;
  top: 14px;
}

.section-title {
  justify-content: space-between;
  margin-bottom: 16px;
}

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 10px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(178, 31, 36, 0.14);
}

.grid {
  display: grid;
  gap: 10px;
}

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

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

.order-detail-input {
  min-height: 180px;
}

.primary {
  background: var(--primary);
  color: white;
}

.topbar .primary {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.topbar .ghost,
.topbar .icon-btn {
  background: #2a2524;
  color: #fff;
}

.topbar .ghost:hover,
.topbar .icon-btn:hover {
  background: #403735;
}

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

.ghost,
.icon-btn {
  background: var(--surface-2);
  color: var(--ink);
}

.danger {
  background: #fff0f0;
  color: var(--danger);
}

.form-actions {
  justify-content: space-between;
}

.message {
  min-height: 18px;
  margin: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  white-space: pre-line;
}

.orders-area {
  display: grid;
  gap: 12px;
  align-content: start;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.summary-strip div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 78px;
  padding: 14px;
}

.summary-strip span {
  display: block;
  font-size: 28px;
  font-weight: 800;
}

.summary-strip small {
  color: var(--muted);
  font-weight: 700;
}

.filters {
  align-items: stretch;
}

.filters input {
  flex: 1;
}

.filters select {
  max-width: 230px;
}

.filters button {
  flex: 0 0 auto;
}

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

.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 12px;
  padding: 9px 12px;
  box-shadow: 0 6px 18px rgba(24, 33, 43, 0.05);
}

.order-card[data-status="Preparado"] {
  border-left-color: var(--warning);
}

.order-card[data-status="Provisorio"] {
  border-left-color: var(--ready);
}

.order-card[data-status="Despachado"] {
  border-left-color: var(--done);
}

.order-card[data-sale-type="Mayorista"] {
  border-top: 4px solid #161616;
}

.order-card[data-sale-type="Minorista"] {
  border-top: 4px solid var(--primary);
}

.order-card[data-status="Cancelado"] {
  border-left-color: var(--danger);
  opacity: 0.72;
}

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

.order-title {
  margin: 0;
  font-size: 16px;
  white-space: nowrap;
}

.order-main {
  min-width: 0;
}

.order-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.origin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 4px 9px;
  background: #e8edf0;
  color: #40515c;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.order-card[data-origin="cliente"] {
  background: #fff7df;
  box-shadow: 0 0 0 2px #f4b740, 0 8px 22px rgba(180, 111, 0, 0.16);
}

.order-card[data-origin="cliente"] .origin-badge {
  background: #d97706;
  color: #fff;
}

.sale-type-banner {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  margin: 0;
  padding: 4px 9px;
  background: #f5e9e8;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.order-card[data-sale-type="Mayorista"] .sale-type-banner {
  background: #eeeae7;
  color: #2f2927;
}

.order-meta,
.order-detail,
.order-notes {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.order-meta {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  align-self: start;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  min-width: auto;
  padding: 4px 9px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.order-card[data-status="Provisorio"] .status-pill {
  background: #f2ece8;
  color: #5d3b2d;
}

.client-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 34%),
    #050505;
  color: #111;
}

.client-shell {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 4vw, 42px) clamp(12px, 4vw, 28px);
}

.client-panel {
  overflow: hidden;
  padding: 0;
  border: 1px solid #2c2c2c;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

.client-brand {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  align-items: center;
  gap: clamp(20px, 5vw, 46px);
  padding: clamp(24px, 5vw, 46px);
  background: #000;
  color: #fff;
}

.client-logo {
  display: block;
  width: 100%;
  max-height: 210px;
  object-fit: contain;
}

.client-brand-copy .eyebrow {
  margin-bottom: 10px;
  color: #bdbdbd;
  letter-spacing: 0.16em;
}

.client-brand-copy h1 {
  font-size: clamp(34px, 7vw, 58px);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.client-brand-copy > p:last-child {
  max-width: 400px;
  margin: 16px 0 0;
  color: #d7d7d7;
  font-size: 15px;
  line-height: 1.55;
}

.client-order-form,
.client-document-groups {
  padding-right: clamp(18px, 5vw, 44px);
  padding-left: clamp(18px, 5vw, 44px);
}

.client-order-form {
  padding-top: clamp(24px, 5vw, 40px);
  padding-bottom: clamp(28px, 5vw, 46px);
  gap: 18px;
}

#clientDeliveryTypeSection {
  display: grid;
  gap: 12px;
}

#clientDeliveryTypeSection[hidden] {
  display: none;
}

.client-caba-section {
  display: grid;
  gap: 16px;
  border: 2px solid #9f171b;
  border-radius: 14px;
  background: linear-gradient(145deg, #fff 0%, #fff6f6 100%);
  padding: 18px;
}

.client-caba-section[hidden] {
  display: none;
}

.client-caba-heading {
  display: grid;
  gap: 5px;
  color: #1b1b1b;
}

.client-caba-heading strong {
  color: #921418;
  font-size: 20px;
}

.client-caba-heading span {
  font-size: 14px;
  line-height: 1.45;
}

.client-caba-shipping {
  border-radius: 10px;
  background: #161616;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
  padding: 14px;
}

.client-caba-shipping.free {
  background: #17613c;
}

.client-page label {
  color: #252525;
  font-size: 13px;
  letter-spacing: 0.015em;
}

.client-page input,
.client-page select,
.client-page textarea {
  min-height: 48px;
  border: 1px solid #b9b9b9;
  border-radius: 10px;
  background: #fff;
  color: #080808;
  padding: 12px 13px;
}

.client-page textarea {
  line-height: 1.5;
}

.client-page input:focus,
.client-page select:focus,
.client-page textarea:focus {
  border-color: #000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.13);
}

.client-documents {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.client-document-groups {
  display: grid;
  gap: 18px;
  margin: 0;
  padding-top: 26px;
}

.client-document-groups[hidden],
.client-document-group[hidden] {
  display: none;
}

.client-document-group h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.client-documents[hidden] {
  display: none;
}

.client-documents .button-link {
  justify-content: center;
  padding: 13px 16px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  text-align: center;
}

.offers-button {
  background: #fff1cf;
  border: 1px solid #d89712;
  color: #6c4300;
  font-weight: 800;
}

.client-notice {
  border: 1px solid #d1d1d1;
  border-left: 4px solid #111;
  border-radius: 10px;
  background: #f4f4f4;
  color: #222;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  padding: 12px;
}

.client-cutoff-notice {
  display: grid;
  gap: 6px;
  border: 3px solid #dc2626;
  border-radius: 10px;
  background: #fff1f1;
  color: #8b1111;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(185, 28, 28, 0.18);
}

.client-cutoff-notice[hidden] {
  display: none;
}

.client-cutoff-notice strong {
  font-size: 20px;
  letter-spacing: 0.02em;
}

.client-cutoff-notice span {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

.client-success {
  display: grid;
  gap: 8px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  background: #fff1f1;
  color: #67191c;
  font-size: 15px;
  line-height: 1.35;
  padding: 16px;
}

.client-page .client-success {
  border-color: #111;
  background: #f1f1f1;
  color: #111;
}

.client-success strong {
  font-size: 20px;
}

.client-success span {
  display: block;
}

.client-submit {
  width: 100%;
  min-height: 54px;
  border-radius: 10px;
  background: #050505;
  color: #fff;
  font-size: 16px;
  letter-spacing: 0.035em;
}

.client-submit:hover {
  background: #292929;
}

.pill-stack {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.priority-pill {
  border-radius: 999px;
  background: #f5e9e8;
  color: var(--primary-dark);
  min-width: auto;
  padding: 4px 9px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.order-card[data-priority="Alta"] .priority-pill {
  background: #fff0f0;
  color: var(--danger);
}

.order-card[data-priority="Baja"] .priority-pill {
  background: #eef3f6;
  color: var(--muted);
}

.order-detail {
  margin-top: 9px;
  color: var(--ink);
}

.order-expanded {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.trace-box {
  margin-top: 10px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.trace-box h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.trace-item {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding: 7px 0;
  color: var(--ink);
  font-size: 13px;
}

.trace-item:first-of-type {
  border-top: 0;
}

.trace-item span,
.trace-item small,
.trace-empty {
  color: var(--muted);
}

.trace-item small {
  line-height: 1.35;
}

.order-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.card-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.delivery-module {
  padding: 18px clamp(16px, 4vw, 38px) 32px;
}

.delivery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.delivery-head h2 {
  font-size: 30px;
}

.delivery-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.route-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.route-summary div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 76px;
  padding: 14px;
}

.route-summary span {
  display: block;
  font-size: 26px;
  font-weight: 900;
}

.route-summary small {
  color: var(--muted);
  font-weight: 800;
}

.route-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

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

.route-stop {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  padding: 9px 12px;
  box-shadow: 0 6px 18px rgba(24, 33, 43, 0.05);
}

.route-stop[data-priority="Alta"] {
  border-left-color: var(--danger);
}

.route-stop[data-sale-type="Mayorista"] {
  box-shadow: inset 0 4px 0 #171717, 0 6px 18px rgba(24, 33, 43, 0.05);
}

.route-stop[data-sale-type="Mayorista"] .sale-type-banner {
  background: #f2ece8;
  color: #5d3b2d;
}

.route-stop[data-priority="Alta"] .priority-pill {
  background: #fff0f0;
  color: var(--danger);
}

.route-stop[data-priority="Baja"] .priority-pill {
  background: #eef3f6;
  color: var(--muted);
}

.route-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.route-number {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 900;
}

.route-body {
  min-width: 0;
  flex: 1;
}

.route-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.route-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 900;
}

.route-address {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.route-meta,
.route-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.route-meta {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.route-detail {
  color: var(--ink);
}

.route-expanded {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.route-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.route-actions select,
.route-actions button {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
}

.route-actions select {
  width: auto;
  min-width: 126px;
}


.customers-module {
  padding: 18px clamp(16px, 4vw, 38px) 36px;
}

.customers-head,
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.customers-head {
  margin-bottom: 14px;
}

.customers-head h2,
.dialog-head h2 {
  margin: 0;
  font-size: 30px;
}

.customers-intro {
  margin: 5px 0 0;
  color: var(--muted);
}

.customer-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wholesale-register-panel {
  max-width: 760px;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
}

.wholesale-register-form {
  padding: clamp(24px, 5vw, 42px);
}

.wholesale-brand {
  grid-template-columns: minmax(140px, 190px) 1fr;
}

.wholesale-register-panel .form-actions {
  margin-top: 18px;
}

.customer-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.customer-summary div {
  min-height: 72px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.customer-summary span {
  display: block;
  font-size: 25px;
  font-weight: 900;
}

.customer-summary small {
  color: var(--muted);
  font-weight: 800;
}

.customer-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px);
  gap: 10px;
  margin-bottom: 14px;
}

.customer-agenda-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.customer-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(24, 33, 43, 0.05);
}

.customer-card-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.customer-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 18px;
  font-weight: 900;
}

.customer-card-data {
  min-width: 0;
  flex: 1;
}

.customer-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
}

.customer-title-line h3 {
  margin: 0;
  font-size: 18px;
}

.customer-type {
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.customer-type.mayorista {
  background: #e7f1ff;
  color: #5d3b2d;
}

.customer-type.minorista {
  background: #e8f8f4;
  color: var(--primary);
}

.customer-card p {
  margin: 4px 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.customer-notes {
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}

.customer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.customer-stats span {
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.customer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.customer-actions button,
.customer-actions .button-link {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.customer-whatsapp {
  border-color: #1f9d59;
  color: #167343;
}

.customer-history {
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.customer-history h4 {
  margin: 0 0 8px;
}

.customer-history-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
  font-size: 12px;
}

.customer-history-row span {
  color: var(--muted);
  text-align: right;
}

.customer-history-row p {
  grid-column: 1 / -1;
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink);
}

.customer-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(16, 27, 37, 0.3);
}

.customer-dialog::backdrop {
  background: rgba(16, 27, 37, 0.55);
}

.customer-dialog form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.customer-dialog .dialog-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.offers-studio-module {
  padding: 18px clamp(16px, 4vw, 38px) 40px;
}

.availability-panel {
  margin: 0 clamp(16px, 4vw, 38px) 18px;
  padding: 18px;
}

.availability-heading p,
.availability-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.availability-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(180px, 0.9fr) minmax(240px, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.availability-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.availability-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafb;
}

.availability-badge {
  display: inline-block;
  margin-left: 9px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.availability-badge.closed {
  background: #fee2e2;
  color: #991b1b;
}

.availability-badge.no-delivery {
  background: #fef3c7;
  color: #92400e;
}

.offers-studio-head,
.offer-preview-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.offers-studio-head {
  margin-bottom: 18px;
}

.offers-studio-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.offers-studio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.offers-studio-layout {
  display: grid;
  grid-template-columns: minmax(430px, 0.9fr) minmax(390px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.offer-poster-form,
.offer-preview-panel {
  padding: 20px;
}

.offer-preview-toolbar p {
  margin-bottom: 0;
}

.offer-paste-area {
  min-height: 245px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 1.55;
  resize: vertical;
}

.offer-paste-help {
  margin: -6px 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.offer-business-fields {
  display: grid;
  gap: 12px;
  margin: 4px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafb;
}

.offer-business-fields legend {
  padding: 0 6px;
  font-weight: 800;
}

.offer-preview-panel {
  position: sticky;
  top: 14px;
  background: #111;
  color: white;
}

.offer-preview-toolbar {
  align-items: center;
  margin-bottom: 16px;
}

.offer-preview-toolbar .eyebrow {
  color: #cfcfcf;
}

.offer-preview-toolbar span {
  color: #bdbdbd;
  font-size: 12px;
  font-weight: 800;
}

.offer-canvas-frame {
  display: grid;
  place-items: center;
  max-height: 72vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid #383838;
  border-radius: 12px;
  background: #171717;
}

#offerPosterCanvas {
  display: block;
  width: auto;
  max-width: 100%;
  height: min(64vh, 760px);
  border-radius: 5px;
  background: #050505;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
}


@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .form-panel {
    position: static;
  }

  .route-layout {
    grid-template-columns: 1fr;
  }

  .customer-agenda-list {
    grid-template-columns: 1fr;
  }

  .offers-studio-layout {
    grid-template-columns: 1fr;
  }

  .offer-preview-panel {
    position: static;
  }

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

}

@media (max-width: 680px) {
  .admin-brand {
    min-width: 0;
  }

  .admin-logo {
    width: 112px;
    height: 72px;
    margin: 0 auto;
  }

  .admin-brand-copy,
  .brand-subtitle {
    text-align: center;
  }

  .client-shell {
    padding: 0;
  }

  .client-panel {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .client-brand {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 26px 22px 30px;
    text-align: center;
  }

  .wholesale-brand {
    grid-template-columns: 1fr;
  }

  .client-logo {
    width: min(230px, 72vw);
    max-height: 175px;
    margin: 0 auto;
  }

  .client-brand-copy > p:last-child {
    margin-right: auto;
    margin-left: auto;
  }

  .online-order-alert {
    align-items: center;
    flex-wrap: wrap;
  }

  .online-order-alert button {
    flex-basis: 100%;
  }

  .topbar,
  .top-actions,
  .filters,
  .order-top,
  .order-bottom,
  .pill-stack,
  .delivery-head,
  .delivery-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .customers-head,
  .customer-card-main {
    align-items: stretch;
    flex-direction: column;
  }

  .pill-stack {
    justify-items: stretch;
  }

  .two,
  .three,
  .summary-strip,
  .route-summary,
  .route-stop {
    grid-template-columns: 1fr;
  }

  .customer-summary,
  .customer-toolbar,
  .document-grid,
  .client-documents {
    grid-template-columns: 1fr;
  }

  .documents-head {
    align-items: stretch;
    flex-direction: column;
  }

  .offers-studio-head,
  .offer-preview-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .route-top {
    align-items: flex-start;
  }

  .route-actions {
    justify-content: flex-start;
  }

  .filters select {
    max-width: none;
  }
}
