:root {
  --accent: #2f6b3f;          /* verde botánico HSM */
  --accent-soft: #e8f2ea;
  --ink: #14201a;
  --muted: #6b7a70;
  --line: #e3e8e4;
  --bg: #f7f9f7;
  --card: #ffffff;
  --red: #c0392b;
  --amber: #b07d18;
  --green: #2f8f4e;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.mono, .pill, .field > span, th, .brand-sub, .stat-label, .log-kind {
  font-family: 'JetBrains Mono', monospace;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 32px;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 14px 28px; position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.brand-name { font-weight: 800; letter-spacing: .04em; font-size: 14px; }
.brand-sub { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  text-decoration: none; color: var(--muted); font-weight: 600; padding: 8px 14px;
  border-radius: 8px; font-size: 13px;
}
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.nav a:hover { color: var(--ink); }

/* ---------- Layout ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- Cards / stats ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; }
.stat-value small { font-size: 14px; color: var(--muted); font-weight: 600; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 600;
}
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fafcfa; }
.td-actions { text-align: right; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 36px 0; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  padding: 4px 10px; border-radius: 999px; background: #f0f2f0; color: var(--muted);
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: #e7f4ec; color: var(--green); }
.pill-amber { background: #faf3e2; color: var(--amber); }
.pill-red { background: #fbeae8; color: var(--red); }
.pill-gray { background: #f0f2f0; color: var(--muted); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- Buttons / forms ---------- */
.btn {
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 13px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #275a35; color: #fff; }
.btn-danger:hover { border-color: var(--red); color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { border: none; background: none; cursor: pointer; font-size: 14px; color: var(--muted); }
.btn-icon:hover { color: var(--ink); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-family: 'Inter', sans-serif; font-size: 14px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 16px; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20, 32, 26, .45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card { width: 360px; }
.modal-card { width: 520px; max-width: 100%; max-height: 86vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { font-size: 16px; font-weight: 700; }

/* ---------- Dashboard event rows ---------- */
.event-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.event-row:last-child { border-bottom: none; }
.event-row:hover .ev-name { color: var(--accent); }
.ev-date {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted);
  width: 84px; flex: 0 0 auto; text-transform: uppercase; line-height: 1.5;
}
.ev-date b { display: block; font-size: 18px; color: var(--ink); }
.ev-main { flex: 1; min-width: 0; }
.ev-name { font-weight: 700; font-size: 14px; }
.ev-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ev-progress { width: 220px; flex: 0 0 auto; }
.bar { height: 6px; background: #edf0ed; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.bar.over > div { background: var(--amber); }
.ev-counts { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* ---------- Log ---------- */
.log-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.log-row:last-child { border-bottom: none; }
.log-time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.log-kind { font-size: 10px; flex: 0 0 96px; text-transform: uppercase; letter-spacing: .06em; }
.log-kind.out { color: var(--accent); }
.log-kind.in { color: var(--amber); }
.log-body { color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-body b { font-weight: 600; }

/* ---------- Convocar checklist ---------- */
.check-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-item:last-child { border-bottom: none; }
.check-item:hover { background: #fafcfa; }
.check-item input { accent-color: var(--accent); width: 15px; height: 15px; }
.check-item .ci-role { margin-left: auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.toast.error { background: var(--red); }

/* ---------- Conversación WhatsApp (ficha camarero) ---------- */
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow-y: auto; padding: 4px 2px; }
.msg { max-width: 78%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.msg.out { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 3px; }
.msg.in { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg.sys { align-self: center; background: none; color: var(--muted); font-size: 11px; font-style: italic; padding: 2px 8px; text-align: center; }
.msg .meta { font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 5px; }
.log-kind.sys { color: #7c6fb0; }

/* Enlaces de fila y toggle titular/reserva */
.row-link { color: var(--ink); text-decoration: none; }
.row-link:hover { color: var(--accent); }
.kind-toggle { margin-left: 10px; flex: 0 0 auto; min-width: 72px; }
.kind-toggle.is-reserva { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; margin: 26px 0 10px; font-family: 'JetBrains Mono', monospace; }
.muted { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .ev-progress { display: none; }
  .nav a { padding: 8px 10px; }
}
