:root {
  --ink: #1c1a18;
  --muted: #767066;
  --faint: #a39c92;
  --border: #e8e3db;
  --surface: #ffffff;
  --bg: #faf8f5;
  --accent: #6b4a35;
  --accent-hover: #543823;
  --ok: #1a7f4e;
  --ok-bg: #eef8f2;
  --bad: #b3271e;
  --bad-bg: #fbeceb;
  --warn-bg: #fbf3e3;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 440px; margin: 0 auto; padding: 40px 20px 100px; }

h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 20px;
}

p { color: var(--muted); }

/* ── Targetes ────────────────────────────────────────────────────────── */

.auth-card, .account-card, .qr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
}

.auth-card label {
  display: block;
  margin: 16px 0 6px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.auth-card label:first-of-type { margin-top: 0; }

.auth-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  background: var(--bg);
  color: var(--ink);
  transition: border-color .15s;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

/* ── Botons ──────────────────────────────────────────────────────────── */

button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .5; cursor: default; }

#auth-form button[type="submit"] { width: 100%; margin-top: 22px; }

button.danger {
  background: var(--bad-bg);
  color: var(--bad);
}
button.danger:hover { background: #f6dcda; }

.secondary-btn {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  width: 100%;
  margin-top: 10px;
  font-weight: 500;
}
.secondary-btn:hover { background: var(--bg); border-color: var(--faint); }

/* Accions de només text (sense caixa de botó) — llistes i taules */
.text-action {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.text-action:hover { color: var(--ink); }
.text-action.positive:hover { color: var(--ok); }
.text-action.negative:hover { color: var(--bad); }

.link-btn {
  background: none;
  color: var(--muted);
  padding: 8px 0;
  display: inline-block;
  font-weight: 600;
  font-size: .9rem;
}
.link-btn:hover { background: none; color: var(--ink); }

.hint { color: var(--faint); font-size: .82rem; margin-top: 18px; line-height: 1.5; }
.hint a { color: var(--accent); }

/* ── Sol·licituds pendents ───────────────────────────────────────────── */

.pending-list { display: flex; flex-direction: column; gap: 1px; margin: 8px 0 32px; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.pending-item { background: var(--surface); padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.pending-item:last-child { border-bottom: none; }
.pending-item small { color: var(--faint); }
.pending-item .pending-actions { display: flex; gap: 18px; flex-shrink: 0; }
.pending-item .pending-actions button { padding: 8px 14px; font-size: .82rem; }

/* ── Estats i avisos ─────────────────────────────────────────────────── */

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  margin: 4px 0 16px;
}
.status-ok { background: var(--ok-bg); color: var(--ok); }
.status-bad { background: var(--bad-bg); color: var(--bad); }
.notice { background: var(--warn-bg); color: #7a5a1e; padding: 12px 14px; border-radius: var(--radius-sm); font-size: .85rem; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

.error { color: var(--bad); background: var(--bad-bg); padding: 11px 14px; border-radius: var(--radius-sm); margin: 12px 0; font-size: .88rem; }

.qr-card { text-align: center; }
#qr-canvas-wrap { margin: 20px 0; }

/* ── Personal ────────────────────────────────────────────────────────── */

.staff-nav { display: flex; gap: 24px; align-items: center; padding: 4px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.staff-nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; padding-bottom: 2px; }
.staff-nav a.active { color: var(--ink); border-bottom: 2px solid var(--accent); }
.staff-nav .link-btn { margin-left: auto; padding: 0; }

.scanner-view { position: relative; }
#scanner-video { width: 100%; border-radius: var(--radius-md); background: #000; }
.scanner-result { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 1.3rem; text-align: center; padding: 24px; }
.scanner-result[hidden] { display: none; }
.result-ok { background: rgba(26,127,78,.97); color: #fff; }
.result-bad { background: rgba(179,39,30,.97); color: #fff; }
.member-photo { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; }
.result-name { font-weight: 700; font-size: 1.6rem; }

/* ── Taula de socis ──────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 0 12px 10px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--faint);
  border-bottom: 1px solid var(--border);
}
tbody td { text-align: left; padding: 13px 12px; font-size: .88rem; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody td small { color: var(--faint); }
