/* ── Reset & Variables ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #1b3a6b;
  --brand-dark:  #142d53;
  --brand-light: #2a5098;
  --bg:          #f5efe3;
  --surface:     #ffffff;
  --border:      #d4c9b0;
  --text:        #242320;
  --text-muted:  #706e66;
  --danger:      #dc2626;
  --radius:      10px;
  --shadow:      0 1px 3px rgba(0,0,0,.1);
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

/* ── Navbar ────────────────────────────────────────────── */
.navbar {
  background: var(--brand);
  color: #fff;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.nav-brand {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: .5rem;
}

.nav-links a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: .35rem .7rem;
  border-radius: 6px;
  font-size: .875rem;
  transition: background .15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,.2);
  color: #fff;
}

.nav-logout-form { display: block; }

.nav-logout-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: .35rem .7rem;
  border-radius: 6px;
  font-size: .875rem;
  font-family: inherit;
  transition: background .15s;
}

.nav-logout-btn:hover { background: rgba(255,255,255,.2); color: #fff; }

/* Notas de voz en el chat: reproductor + la transcripción abajo, para poder
   leerla de un vistazo sin tener que escuchar el audio entero. */
.chat-audio {
  display: block;
  width: 100%;
  max-width: 230px;
  height: 38px;
  margin-bottom: .35rem;
}

/* Comprobante mandado como archivo (PDF): va como link, no como imagen. */
.chat-archivo {
  display: inline-block;
  font-size: .85em;
  font-weight: 600;
  text-decoration: underline;
  color: inherit;
}

/* Texto que acompaña a una foto: el nombre del producto, o lo que escribió el
   cliente junto al comprobante. */
.chat-pie {
  display: block;
  margin-top: .3rem;
}

.chat-transcripcion {
  display: block;
  font-style: italic;
  opacity: .85;
  font-size: .85em;
}

/* Aviso de error arriba de una página (ej. teléfono repetido al cargar un
   cliente). Antes esos casos redirigían en silencio y no se veía nada. */
.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .9rem;
  margin-bottom: 1rem;
}

/* ── Container ─────────────────────────────────────────── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* ── Page header ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: .75rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.375rem;
  font-weight: 700;
}

.subtitle {
  color: var(--text-muted);
  font-size: .875rem;
  margin-top: .25rem;
}

/* ── Back link ─────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  color: var(--brand);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  padding: .35rem 0;
}

.back-link:hover { text-decoration: underline; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .55rem 1rem;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}

.btn-primary   { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }

.btn-secondary { background: #e0e7ff; color: var(--brand-dark); }
.btn-secondary:hover { background: #c7d2fe; }

.btn-ghost     { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }

.btn-sm        { padding: .55rem .8rem; font-size: .8rem; }

/* ── Filters ───────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.filters input,
.filters select {
  flex: 1 1 140px;
  min-width: 0;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: .875rem;
  background: var(--surface);
  color: var(--text);
  appearance: auto;
}

.filters input:focus,
.filters select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ── Client list ───────────────────────────────────────── */
.client-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

/* ── Paginación ────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.pagination-info {
  font-size: .85rem;
  color: var(--text-muted);
}

.pagination-disabled {
  opacity: .4;
  pointer-events: none;
}

.client-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .15s;
  overflow: hidden;
}

.client-card:has(.client-card-link:hover) { border-color: var(--brand); }

.client-card-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .875rem 1rem;
  flex: 1;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.btn-wpp {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .875rem .875rem;
  color: #16a34a;
  text-decoration: none;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  transition: background .15s;
}

.btn-wpp:hover { background: #dcfce7; }

.client-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.client-name {
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-phone {
  font-size: .8rem;
  color: var(--text-muted);
}

.client-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── Client detail ─────────────────────────────────────── */
.client-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.client-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .75rem;
}

.client-detail-name {
  font-size: 1.25rem;
  font-weight: 700;
}

.client-phone-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: #16a34a;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
}

.client-phone-link:hover { text-decoration: underline; }

.client-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  margin-bottom: .75rem;
}

.client-notes {
  font-size: .875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  white-space: pre-line;
}

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 500;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-type { background: #dbeafe; color: #1e3a5f; }
.badge-consumidor_final { background: #e8dcc8; color: #48463f; }
.badge-barraca          { background: #dbeafe; color: #1e3a5f; }
.badge-constructora     { background: #c7d2fe; color: #312e81; }

.badge-tag     { background: #e0e7ff; color: #1b3a6b; }
.badge-keyword { background: #f5f5f0; color: #5a5850; font-family: monospace; }
.badge-channel { background: #ecfdf5; color: #065f46; }

/* Stock badges */
.badge-ok       { background: #d1fae5; color: #065f46; }
.badge-bajo     { background: #fef3c7; color: #92400e; }
.badge-sin-stock{ background: #fee2e2; color: #991b1b; }

.tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: .6;
  padding: 0 .1rem;
  line-height: 1;
  font-size: .9rem;
}
.tag-remove:hover { opacity: 1; }

/* ── Section header ────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}

.section-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Event list ────────────────────────────────────────── */
.event-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.event-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  box-shadow: var(--shadow);
}

.event-compra       { border-left-color: #16a34a; }
.event-comunicacion { border-left-color: var(--brand); }
.event-nota         { border-left-color: #d97706; }
.event-comprobante  { border-left-color: #7c3aed; }

.comprobante-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: .5rem;
  cursor: zoom-in;
  display: block;
}

.event-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .35rem;
  gap: .5rem;
}

.event-type-badge {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

.event-date { font-size: .75rem; color: var(--text-muted); }

.event-content {
  font-size: .875rem;
  color: var(--text);
  white-space: pre-line;
}

.event-amount {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  font-size: .95rem;
  color: #16a34a;
  margin-top: .35rem;
}

/* ── FAQ ───────────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: 1rem; }

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.faq-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .75rem;
}

.faq-response {
  font-family: inherit;
  font-size: .875rem;
  white-space: pre-wrap;
  color: var(--text);
  background: var(--bg);
  padding: .75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ── Tag options ───────────────────────────────────────── */
.tag-options {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 1rem;
}

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ── Forms ─────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: .875rem;
}

.form-group label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.form-group textarea { resize: vertical; min-height: 72px; }

/* ── Modals ────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;    /* bottom sheet on mobile */
  justify-content: center;
}

.modal.hidden { display: none; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.modal-box {
  position: relative;
  background: var(--surface);
  width: 100%;
  max-width: 520px;
  border-radius: 16px 16px 0 0;
  padding: 1.5rem 1.25rem 2rem;
  max-height: 92dvh;
  overflow-y: auto;
}

.modal-box h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1.125rem;
}

.modal-box-sm { max-width: 360px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: .5rem;
}

/* ── Nav logo ──────────────────────────────────────────── */
.nav-logo { flex-shrink: 0; height: 28px; width: auto; }
.nav-brand { gap: .5rem; }

/* ── Stock grid ────────────────────────────────────────── */
.stock-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}

.stock-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stock-img-wrap {
  flex-shrink: 0;
  width: 90px;
  height: 90px;
  background: #e8e6e0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.stock-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .5;
}

.stock-card-info {
  flex: 1;
  min-width: 0;
  padding: .75rem 0;
}

.stock-name {
  display: block;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
}

.stock-measures {
  display: block;
  font-size: .75rem;
  color: var(--text-muted);
  font-family: monospace;
}

.stock-use {
  display: block;
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: .3rem;
}

.stock-prices {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .25rem;
}

.price-puesto {
  font-size: .8rem;
  font-weight: 700;
  color: var(--brand);
}

.price-levantar {
  font-size: .8rem;
  color: var(--text-muted);
}

.stock-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .4rem;
  padding: .75rem 1rem .75rem 0;
  flex-shrink: 0;
}

.stock-qty-display {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

.stock-status { text-align: right; }

.stock-right-bottom {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.stock-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .35rem;
}

.stock-tipo-toggle {
  display: flex;
  gap: .5rem;
}

@media (max-width: 480px) {
  /* Apilado: imagen + info arriba, cantidad/estado en una fila abajo.
     En una sola fila el texto (nombre, medidas, precios) se envolvía
     mal por falta de espacio. */
  .stock-card { flex-direction: column; align-items: stretch; gap: 0; }
  .stock-img-wrap { width: 100%; height: 130px; }
  .stock-card-info { padding: .75rem 1rem 0; }
  .stock-right {
    flex-direction: column;
    align-items: stretch;
    padding: .75rem 1rem;
    gap: .5rem;
  }
  .stock-right-bottom { justify-content: space-between; }
  .stock-status { text-align: left; }
  .stock-actions { align-items: stretch; }
  .stock-actions .btn { width: 100%; justify-content: center; }
}

/* ── Desktop tweaks ────────────────────────────────────── */
@media (min-width: 600px) {
  .modal { align-items: center; }
  .modal-box { border-radius: var(--radius); max-height: 90vh; }

  .client-card { flex-wrap: nowrap; }
}

/* ── Chat ──────────────────────────────────────────────── */
.chat-window {
  background: #f0ece3;
  border-radius: var(--radius);
  padding: 1rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.chat-bubble-row {
  display: flex;
  padding: 0 .25rem;
}
.chat-in  { justify-content: flex-start; }
.chat-out { justify-content: flex-end; }

.chat-bubble {
  max-width: 82%;
  padding: .5rem .7rem .3rem;
  border-radius: 10px;
  font-size: .88rem;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.chat-text {
  display: block;
  white-space: pre-wrap;
}
.chat-in  .chat-bubble {
  background: #fff;
  border-top-left-radius: 2px;
  color: var(--text);
}
.chat-out .chat-bubble {
  background: #d9fdd3;
  border-top-right-radius: 2px;
  color: #1a1a1a;
}

.chat-time {
  display: block;
  font-size: .68rem;
  text-align: right;
  margin-top: .2rem;
  color: #999;
}
.chat-out .chat-time { color: #7a9a7a; }

.chat-date-divider {
  text-align: center;
  font-size: .72rem;
  color: #888;
  margin: .5rem 0;
}
.chat-date-divider span {
  background: #d8d3ca;
  padding: .2rem .75rem;
  border-radius: 8px;
}

/* ── Inbox ─────────────────────────────────────────────── */
.inbox-wrap {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.inbox-sidebar {
  width: 320px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow-y: auto;
}
.inbox-sidebar-header {
  padding: .9rem 1rem;
  font-weight: 600;
  font-size: .95rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.conv-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
}
.conv-item:hover { background: var(--bg); }
.conv-item.active { background: #eff6ff; }
.conv-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
  flex-shrink: 0;
}
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last { font-size: .8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: .75rem; color: var(--text-muted); flex-shrink: 0; }
.conv-name-unread { font-weight: 700; }
.unread-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }

.inbox-empty { padding: 1.5rem 1rem; color: var(--text-muted); font-size: .9rem; text-align: center; }

.inbox-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f0ece3;
  overflow: hidden;
}
.inbox-chat-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.inbox-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.inbox-input-bar {
  display: flex;
  gap: .5rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  align-items: flex-end;
  flex-shrink: 0;
}
.inbox-input-bar textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .5rem 1rem;
  font-size: .9rem;
  resize: none;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  outline: none;
  max-height: 120px;
}
.inbox-input-bar textarea:focus { border-color: var(--brand); }

.inbox-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .inbox-wrap { position: relative; }
  .inbox-sidebar { width: 100%; position: absolute; inset: 0; z-index: 2; }
  .inbox-sidebar.hidden { display: none; }
  .inbox-chat { position: absolute; inset: 0; z-index: 2; display: none; }
  .inbox-chat.visible { display: flex; }
  .inbox-back {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: none;
    border: none;
    color: var(--brand);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    padding: .6rem .5rem .6rem 0;
    margin: -.6rem 0;
  }
}
@media (min-width: 641px) {
  .inbox-back { display: none; }
}

.inbox-main { width: 100%; height: calc(100vh - 52px); overflow: hidden; padding: 0; max-width: none; }

/* ── Hamburger nav ─────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .65rem;
  border-radius: 6px;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: .2s;
}
.nav-hamburger:hover { background: rgba(255,255,255,.15); }

@media (max-width: 640px) {
  .nav-brand-text { display: none; }
  .nav-hamburger { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: 52px;
    left: 0; right: 0;
    background: var(--brand-dark);
    flex-direction: column;
    padding: .5rem 0;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
  }
  .nav-links.open { display: flex; }
  .nav-links a,
  .nav-links .nav-logout-btn {
    padding: .75rem 1.25rem;
    border-radius: 0;
    font-size: .95rem;
    width: 100%;
    text-align: left;
  }

  /* iOS Safari hace zoom automático sobre cualquier campo cuya letra mida
     menos de 16px, y después la pantalla queda corrida hasta que el usuario
     la vuelve a acomodar a mano. Todos los campos del panel estaban en 13 y
     14px, así que pasaba con el buscador de clientes, el alta de cliente, la
     config del bot y el simulador. En desktop no cambia nada: esto vive solo
     dentro del breakpoint de celular. */
  input,
  textarea,
  select,
  .form-group input,
  .form-group select,
  .form-group textarea,
  .filters input,
  .filters select {
    font-size: 16px;
  }

  /* Botones más grandes para el dedo. Estaban en 32–34px de alto; la guía de
     Apple pide 44 y la de Android 48. Esto se usa parado en la bloquera, no
     sentado con un mouse. */
  .btn,
  .nav-hamburger,
  .btn-wpp {
    min-height: 44px;
  }
  .btn-sm {
    padding: .7rem .9rem;
  }
}

/* Buscador de clientes del alta de pedidos.
   La cruz va DENTRO del campo: una vez elegido el cliente, el datalist filtra
   por el nombre completo que quedó escrito y solo ofrece a ese mismo cliente,
   así que sin un botón para limpiar hay que borrar el texto letra por letra. */
.cliente-buscador {
  position: relative;
  display: flex;
  align-items: center;
}

.cliente-buscador input {
  padding-right: 2.25rem;
}

#cliente-limpiar {
  position: absolute;
  right: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

#cliente-limpiar:hover {
  background: var(--bg);
  color: var(--text);
}

/* Sin esto el display:flex de arriba le gana al atributo `hidden` y la cruz
   quedaría visible con el campo vacío. */
#cliente-limpiar[hidden] {
  display: none;
}

/* Alta de un cliente que no está en la lista, sin salir del pedido. */
.cliente-nuevo {
  margin-top: .5rem;
  padding: .625rem .75rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.cliente-nuevo p {
  margin: 0 0 .5rem;
  font-size: .85rem;
  color: var(--text);
}

.cliente-nuevo-fila {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.cliente-nuevo-fila input {
  flex: 1;
  min-width: 0;
}

.cliente-nuevo-fila button {
  white-space: nowrap;
}

.cliente-nuevo small {
  display: block;
  margin-top: .4rem;
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.cliente-nuevo .cliente-nuevo-error {
  color: var(--danger);
}

/* Sin texto no ocupa lugar: si no, deja un hueco raro debajo del aviso. */
.cliente-nuevo .cliente-nuevo-error:empty {
  display: none;
}
