:root {
  --orange: #ee4d2d;
  --orange-dark: #d73211;
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #222;
  --muted: #888;
  --border: #e8e8e8;
  --green: #26aa99;
  --red: #ff424f;
  --amber: #f59e0b;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Roboto, Helvetica Neue, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.topbar {
  background: linear-gradient(135deg, #ee4d2d 0%, #ff7337 100%);
  color: #fff;
  padding: 14px 0;
  box-shadow: 0 2px 12px rgba(238,77,45,.35);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { font-size: 28px; }
.brand strong { display: block; font-size: 17px; line-height: 1.2; }
.brand small { opacity: .85; font-size: 12px; }

.user-chip { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.15); padding: 6px 8px 6px 6px; border-radius: 40px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #fff; color: var(--orange);
  display: grid; place-items: center; font-weight: 700;
}
.user-meta { line-height: 1.2; }
.user-meta strong { font-size: 13px; display: block; }
.user-meta small { font-size: 11px; opacity: .85; }

main { flex: 1; padding: 28px 0 48px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 20px;
}

.qr-card { max-width: 420px; margin: 0 auto; text-align: center; }
.qr-card h2 { margin-bottom: 4px; }
.qr-card > .muted { margin-bottom: 18px; }

.qr-wrap {
  position: relative;
  width: 240px; height: 240px;
  margin: 0 auto 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fafafa;
}
#qrImg { width: 100%; height: 100%; object-fit: contain; }
.qr-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.85);
  display: grid; place-items: center;
}

.spinner {
  width: 34px; height: 34px;
  border: 3px solid #eee;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.steps { text-align: left; margin: 0 auto 18px; padding-left: 20px; font-size: 13.5px; line-height: 1.9; max-width: 320px; }

.login-status {
  font-size: 13.5px;
  background: #fff7f5;
  color: var(--orange-dark);
  border: 1px dashed #ffc9bd;
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 12px;
}
.login-status.ok { background: #effaf7; color: #1a8377; border-color: #b5e6de; }
.login-status.err { background: #fff1f2; color: #c81e2b; border-color: #ffc4c9; }

.btn {
  border: none; cursor: pointer;
  font-size: 14px; font-weight: 600;
  border-radius: 8px; padding: 10px 18px;
  transition: all .15s ease;
  font-family: inherit;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-outline { background: #fff; color: var(--orange); border: 1px solid var(--orange); }
.btn-outline:hover { background: #fff5f3; }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); padding: 7px 14px; font-size: 12.5px; }
.btn-ghost:hover { background: rgba(255,255,255,.15); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 12px; color: var(--muted); font-weight: 600; }
.filter-group input, .filter-group select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; background: #fff;
}
.filter-group input:focus, .filter-group select:focus { outline: none; border-color: var(--orange); }

.summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary small { color: var(--muted); font-size: 12.5px; display: block; margin-bottom: 4px; }
.summary strong { font-size: 22px; }

.table-card { padding: 0; overflow: hidden; }
.table-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.table-scroll { overflow-x: auto; min-height: 120px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; white-space: nowrap; }
thead th {
  text-align: left; padding: 11px 14px;
  background: #fafafa; color: #555;
  font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid #f2f2f2; }
tbody tr:hover { background: #fffaf8; }
td.wrap { white-space: normal; min-width: 180px; max-width: 340px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge.pending { background: #fef3e2; color: #b26a00; }
.badge.completed { background: #e5f8f5; color: #0f8a7a; }
.badge.cancelled { background: #ffe9eb; color: #cf1f2e; }
.badge.unpaid { background: #f0f0f0; color: #666; }

.empty-state, .error-state { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty-icon { font-size: 42px; margin-bottom: 8px; }
.error-state { color: var(--red); }

.pagination { display: flex; justify-content: center; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }

.footer { text-align: center; padding: 18px; font-size: 12px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 11px 20px;
  border-radius: 8px; font-size: 13.5px; z-index: 99;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  animation: fadeUp .25s ease;
}
.toast.error { background: var(--red); }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 640px) {
  .filters { flex-direction: column; align-items: stretch; }
  .btn-filter-full { width: 100%; }
  table { font-size: 12.5px; }
  thead th, tbody td { padding: 9px 10px; }
}
