/* ───────────────────────── Timbre de Mesa · estilos ─────────────────────────
   Identidad: vino, dorado, crema · Fraunces (display) + Work Sans (texto)      */

:root {
  --vino: #6e1b2e;
  --vino-dark: #5a1626;
  --vino-700: #7b2233;
  --dorado: #c4a052;
  --dorado-bright: #d4af37;
  --crema: #f7f1e7;
  --crema-2: #fbf7ef;
  --panel: #ffffff;
  --ink: #2a1418;
  --muted: #8a7568;
  --line: rgba(110, 27, 46, 0.14);
  --shadow: 0 10px 30px rgba(90, 22, 38, 0.10);
  --shadow-sm: 0 3px 10px rgba(90, 22, 38, 0.08);
  --radius: 16px;

  --st-pendiente: #c0862a;
  --st-asignada: #2f6e8f;
  --st-en_camino: #6d4aa6;
  --st-atendida: #3e7d53;
  --st-cancelada: #98807e;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Work Sans', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--crema-2), var(--crema));
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--vino); }

/* Layout */
.wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 64px; }
.wrap-wide { max-width: 1200px; }

/* Marca */
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  background: linear-gradient(135deg, var(--vino), var(--vino-dark));
  display: grid; place-items: center; color: var(--dorado-bright);
  box-shadow: var(--shadow-sm); border: 1px solid rgba(212, 175, 55, 0.35);
}
.brand .mark svg { width: 26px; height: 26px; }
.brand .name { font-family: 'Fraunces', serif; font-weight: 600; font-size: 20px; color: var(--vino-dark); line-height: 1; }
.brand .sub { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

/* Tarjetas */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-top: 18px;
}
.card.pad-lg { padding: 26px; }
.eyebrow { font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dorado); font-weight: 600; }

/* Contexto zona/punto */
.context-banner {
  background: linear-gradient(135deg, var(--vino), var(--vino-dark));
  color: #fff; border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
  border: 1px solid rgba(212, 175, 55, 0.3);
}
.context-banner .eyebrow { color: var(--dorado-bright); }
.context-banner .zona { font-family: 'Fraunces', serif; font-size: 27px; margin: 6px 0 2px; }
.context-banner .punto { font-size: 15px; opacity: 0.92; }
.context-banner .chip {
  display: inline-block; margin-top: 12px; background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.4); color: var(--dorado-bright);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
}

/* Botones — grandes y táctiles */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 13px; border: 1px solid transparent;
  font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  transition: transform 0.05s ease, filter 0.15s ease, background 0.15s ease; width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--vino), var(--vino-dark)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-gold { background: linear-gradient(135deg, var(--dorado-bright), var(--dorado)); color: var(--vino-dark); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--vino); }
.btn-outline:hover { background: var(--crema); }
.btn-ghost { background: transparent; color: var(--muted); min-height: 44px; font-size: 14px; }
.btn-sm { min-height: 40px; font-size: 14px; padding: 0 14px; width: auto; border-radius: 10px; }
.btn-danger { background: #fff; border-color: rgba(150, 40, 40, 0.35); color: #96302e; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { width: auto; flex: 1; min-width: 120px; }

/* Formularios */
label.field { display: block; margin-top: 16px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--vino-dark); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font-family: inherit; font-size: 16px; color: var(--ink);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--vino); box-shadow: 0 0 0 3px rgba(110, 27, 46, 0.12); }
.help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* Selector de opciones (restaurante / acción) */
.options { display: grid; gap: 12px; margin-top: 8px; }
.option {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fff; cursor: pointer; text-align: left; width: 100%;
  font-family: inherit; font-size: 16px; color: var(--ink); transition: border-color 0.12s, background 0.12s;
}
.option:hover { border-color: var(--dorado); background: var(--crema-2); }
.option.selected { border-color: var(--vino); background: var(--crema); box-shadow: inset 0 0 0 1px var(--vino); }
.option .ico { width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center; background: var(--crema); color: var(--vino); }
.option .ico svg { width: 22px; height: 22px; }
.option .t { font-weight: 600; }
.option .d { font-size: 13px; color: var(--muted); font-weight: 400; }

/* Estados */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.pendiente { color: var(--st-pendiente); background: rgba(192, 134, 42, 0.12); }
.badge.asignada { color: var(--st-asignada); background: rgba(47, 110, 143, 0.12); }
.badge.en_camino { color: var(--st-en_camino); background: rgba(109, 74, 166, 0.12); }
.badge.atendida { color: var(--st-atendida); background: rgba(62, 125, 83, 0.12); }
.badge.cancelada { color: var(--st-cancelada); background: rgba(152, 128, 126, 0.15); }

/* Confirmación */
.confirm-num { font-family: 'Fraunces', serif; font-size: 40px; color: var(--vino-dark); line-height: 1; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }

/* Mensajes */
.alert { border-radius: 12px; padding: 13px 15px; font-size: 14px; margin-top: 14px; border: 1px solid; }
.alert-error { background: #fdf0ef; border-color: rgba(150, 40, 40, 0.3); color: #8c2f2d; }
.alert-info { background: var(--crema-2); border-color: var(--line); color: var(--vino-dark); }
.alert-ok { background: #eef7f0; border-color: rgba(62, 125, 83, 0.3); color: #2f6a45; }

.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.spacer { height: 12px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Empty state */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; opacity: 0.5; margin-bottom: 10px; }

/* Pie */
.footer-note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 26px; }

/* ───────────── Panel (staff/admin) ───────────── */
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(251, 247, 239, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar .who { font-size: 13px; color: var(--muted); }
.topbar .who b { color: var(--vino-dark); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.tab {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--vino);
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tab.active { background: var(--vino); color: #fff; border-color: var(--vino); }
.tab.hidden { display: none; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .field, .filters label.field { margin-top: 0; }
.filters select, .filters input { min-height: 44px; font-size: 14px; }
.filters .f { min-width: 150px; flex: 1; }

.grid-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow-sm); }
.metric .n { font-family: 'Fraunces', serif; font-size: 30px; color: var(--vino-dark); line-height: 1; }
.metric .l { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

/* Cola de solicitudes */
.calls { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.call {
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--dorado); border-radius: 14px;
  padding: 15px 16px; box-shadow: var(--shadow-sm); position: relative;
}
.call.age-1 { border-left-color: var(--st-atendida); }
.call.age-2 { border-left-color: var(--st-pendiente); }
.call.age-3 { border-left-color: #b23b3b; }
.call.closed { opacity: 0.72; border-left-color: var(--st-cancelada); }
.call.is-new { animation: pop 0.5s ease; }
@keyframes pop { 0% { transform: scale(0.98); box-shadow: 0 0 0 4px rgba(196, 160, 82, 0.4); } 100% { transform: scale(1); } }
.call .row1 { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.call .code { font-weight: 700; font-family: ui-monospace, monospace; font-size: 14px; color: var(--vino-dark); }
.call .type { font-family: 'Fraunces', serif; font-size: 18px; margin: 8px 0 2px; }
.call .meta { font-size: 13px; color: var(--muted); }
.call .meta b { color: var(--ink); font-weight: 600; }
.call .elapsed { font-size: 12px; font-weight: 700; }
.call .note { background: var(--crema-2); border-radius: 9px; padding: 8px 10px; font-size: 13px; margin-top: 10px; border: 1px solid var(--line); }
.call .actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.call .actions .btn { width: auto; flex: none; }
.new-dot { position: absolute; top: -6px; right: -6px; background: #b23b3b; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }

/* Tabla historial */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--crema-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }

/* QR */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.qr-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-align: center; box-shadow: var(--shadow-sm); }
.qr-card .qbox { background: var(--crema-2); border-radius: 12px; padding: 10px; display: grid; place-items: center; }
.qr-card .qbox svg { width: 100%; height: auto; max-width: 180px; }
.qr-card .lbl { font-weight: 700; margin-top: 10px; color: var(--vino-dark); }
.qr-card .url { font-size: 11px; color: var(--muted); word-break: break-all; margin: 6px 0 10px; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(42, 20, 24, 0.5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 18px; padding: 22px; max-width: 460px; width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); max-height: 90vh; overflow: auto; }

/* Toast */
.toast-host { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 32px); max-width: 420px; }
.toast { background: var(--vino-dark); color: #fff; border-radius: 12px; padding: 12px 16px; font-size: 14px; box-shadow: var(--shadow); border: 1px solid rgba(212, 175, 55, 0.4); animation: slideup 0.25s ease; }
.toast.err { background: #8c2f2d; }
@keyframes slideup { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Spinner */
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--vino); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .call .actions .btn { flex: 1; }
  .confirm-num { font-size: 34px; }
  .context-banner .zona { font-size: 23px; }
}
