/* Componentes de la maqueta que comparten la tienda y el panel: botones, formularios,
   tablas, tarjetas, mensajes e insignias. */

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--r-pill); padding: 11px 22px;
  font-weight: 500; font-size: 15px; text-decoration: none; cursor: pointer;
  transition: background .2s, transform .2s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--stem); }
.btn-wa { background: var(--wa-bg); color: var(--wa-fg); }
.btn-wa:hover { background: var(--wa-bg-hover); }
.btn-sm { padding: 7px 14px; font-size: 14px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.linkish {
  background: none; border: 0; color: var(--rose); padding: 0; font-size: 13px;
  text-decoration: underline; text-underline-offset: 3px;
}
.acciones { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Formularios */
.field { display: grid; gap: 5px; font-size: 14px; }
.field label { font-weight: 500; }
.field input, .field select, .field textarea {
  font-size: 15px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; width: 100%;
}
/* El borde cambia y además se conserva el contorno de :focus-visible: sólo el color de
   borde no basta para quien navega con teclado. */
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--stem); }
.field .ayuda { font-size: 13px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--rose); width: auto; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input {
  font-size: 14px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px;
}

/* Tablas */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); }
.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface);
}
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t .sub { display: block; font-size: 12px; color: var(--muted); }
.t .vacia { text-align: center; color: var(--muted); padding-block: 24px; }

/* Tarjetas */
.panel-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 18px; display: grid; gap: 12px; min-width: 0; align-content: start;
}
.panel-card h3 { font-size: 22px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 18px; display: grid; gap: 4px;
}
.kpi span { font-size: 13px; color: var(--muted); }
.kpi strong { font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi.warn { background: var(--blush); border-color: transparent; }

/* Mensajes */
.note {
  font-size: 13px; color: var(--muted); background: var(--surface);
  border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin: 0;
}
.err { color: var(--rose-deep); font-size: 13px; margin: 0; }
.ok-msg { color: var(--stem-deep); font-size: 13px; margin: 0; }
.aviso {
  border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; margin: 0;
  background: var(--surface); border-left: 4px solid var(--stem);
}
.aviso-error { background: var(--blush); border-left-color: var(--rose); }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--nav-bg); color: var(--nav-fg); padding: 10px 18px; border-radius: var(--r-pill);
  font-size: 14px; z-index: 80; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* Insignias y estados */
.badge {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  background: var(--marigold); color: #5a3413; font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: var(--r-pill);
}
.badge.new { background: var(--sage); color: var(--ink); }
.pill { display: inline-block; border-radius: var(--r-pill); padding: 2px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.members { background: var(--sage); color: var(--stem-deep); }
.code {
  font-family: ui-monospace, Menlo, monospace; background: var(--blush); color: var(--rose-deep);
  border-radius: var(--r-sm); padding: 4px 10px; font-size: 14px; letter-spacing: .06em;
}
.st { display: inline-block; border-radius: var(--r-pill); padding: 3px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.st-pagado { background: var(--sage); color: #3d5023; }
.st-pendiente { background: var(--marigold); color: #6b3a10; }
.st-preparacion { background: var(--sky); color: #164a68; }
.st-enviado { background: #e6dcf5; color: #4d3478; }
.st-entregado { background: #d2ecd9; color: #1e5a33; }
.st-cancelado { background: #efe9e4; color: #6d6359; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 460px) {
  .row2 { grid-template-columns: 1fr; }
}
