/* Stamp — merchant dashboard styles */

:root {
  --bg: #0a0c11;
  --bg-elev: #12151d;
  --card: #171b25;
  --card-hover: #1c2130;
  --line: #262b3a;
  --line-strong: #333949;
  --fg: #eef0f5;
  --mut: #8a92a6;
  --mut-2: #666d80;

  --acc: #7c7cff;
  --acc-2: #5a5aff;
  --acc-soft: rgba(124, 124, 255, 0.15);

  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.12);

  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--mut); }
.small { font-size: 12px; }
h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mut); }
a { color: var(--acc); }

/* -------- Buttons -------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: 500 13px/1 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary   { background: var(--acc); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--acc-2); }
.btn.ghost     { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--card-hover); border-color: var(--line-strong); }
.btn.danger    { background: var(--bad); color: #fff; }
.btn.tiny      { padding: 5px 10px; font-size: 12px; }
.btn.block     { width: 100%; margin-top: 12px; padding: 11px; }

/* -------- Inputs -------- */

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--mut);
  margin: 12px 0 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  transition: border-color 0.15s, background 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--acc);
  background: var(--bg);
}
input[type=color] { padding: 3px; height: 42px; }
textarea { resize: vertical; min-height: 76px; font-family: inherit; }

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }

/* -------- Toasts -------- */

#toasts {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
  animation: toast-in 0.25s ease;
  border-left: 3px solid;
  background: var(--card);
  min-width: 260px;
  max-width: 400px;
}
.toast.ok   { border-left-color: var(--ok);   color: var(--ok); background: var(--ok-soft); }
.toast.err  { border-left-color: var(--bad);  color: var(--bad); background: var(--bad-soft); }
.toast.info { border-left-color: var(--acc);  color: var(--fg); background: var(--card); }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* -------- Auth -------- */

.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.brand-lg { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-elev);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin: 20px 0 8px;
}
.tab {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--mut);
  font: 500 13px 'Inter';
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.tab.active { background: var(--card); color: var(--fg); }

/* -------- App shell -------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 57px);
}

/* -------- Sidebar -------- */

.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  padding: 20px 12px;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mut);
}
.nav-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.12s;
}
.nav-item:hover { background: var(--card); }
.nav-item.active { background: var(--acc-soft); color: var(--acc); }
.nav-item .swatch-sm { width: 10px; height: 10px; border-radius: 50%; }

/* -------- Content -------- */

.content { padding: 32px 40px; max-width: 1080px; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  gap: 20px;
}
.page-head-actions { display: flex; gap: 8px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 32px 0 14px;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--mut);
}
.empty-icon {
  font-size: 46px;
  color: var(--acc);
  margin-bottom: 10px;
}
.empty h2 { color: var(--fg); margin-bottom: 6px; }
.empty .btn { margin-top: 18px; }

/* -------- Grid & cards -------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.camp-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.08s;
  position: relative;
  overflow: hidden;
}
.camp-card:hover { border-color: var(--line-strong); background: var(--card-hover); }
.camp-card:active { transform: scale(0.99); }
.camp-card .accent-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--acc);
}
.camp-card .camp-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}
.camp-card .camp-reward {
  color: var(--mut);
  font-size: 13px;
  margin-bottom: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.camp-card .badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-elev);
  color: var(--mut);
  border: 1px solid var(--line);
}
.badge.acc { background: var(--acc-soft); color: var(--acc); border-color: transparent; }

.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-num {
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.01em;
}

/* Customer list */
.customer-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.customer-row {
  display: grid;
  grid-template-columns: 1fr 1fr 100px 100px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  gap: 12px;
}
.customer-row:last-child { border-bottom: none; }
.customer-row.head {
  background: var(--bg-elev);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mut);
  padding: 10px 18px;
}
.customer-row code { font-size: 12px; color: var(--mut); }
.progress {
  height: 6px;
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: hidden;
}
.progress > div { height: 100%; background: var(--acc); transition: width 0.3s; }
.customer-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--mut);
  font-size: 13px;
}

/* -------- Modal -------- */

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-back.open { display: flex; animation: fade-in 0.15s ease; }
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  width: min(540px, 92vw);
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-head h3 {
  margin: 0;
  color: var(--fg);
  text-transform: none;
  letter-spacing: 0;
  font-size: 16px;
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* -------- Scan panel -------- */

.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--acc);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(124, 124, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  transition: transform 0.15s, background 0.15s;
}
.fab:hover { background: var(--acc-2); transform: scale(1.05); }

.scan-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(400px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  transform: translateY(140%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.scan-panel.open { transform: translateY(0); }
.scan-panel-inner { padding: 20px; }
.scan-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.scan-head h3 { margin: 0; text-transform: none; letter-spacing: 0; color: var(--fg); font-size: 15px; }
.reader { margin: 14px 0; border-radius: var(--radius-sm); overflow: hidden; max-width: 100%; }
.reader video { border-radius: var(--radius-sm); }
.scan-controls { display: flex; gap: 8px; margin-bottom: 8px; }
.or-line {
  position: relative;
  text-align: center;
  margin: 14px 0 6px;
}
.or-line::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1px solid var(--line);
}
.or-line span {
  position: relative;
  background: var(--card);
  padding: 0 10px;
  color: var(--mut);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Scan-panel mode picker */
.mode-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 4px;
}
.mode-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--fg);
  font: 500 12px 'Inter', sans-serif;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.mode-chip:hover { border-color: var(--line-strong); }
.mode-chip.active { background: var(--acc); border-color: var(--acc); color: #fff; }
.mode-chip.danger { color: var(--bad); border-color: rgba(248,113,113,.3); }
.mode-chip.danger.active { background: var(--bad); border-color: var(--bad); color: #fff; }
.mode-chip.success { color: var(--ok); border-color: rgba(74,222,128,.3); }
.mode-chip.success.active { background: var(--ok); border-color: var(--ok); color: #0a0c11; }
.mode-desc {
  font-size: 12px;
  color: var(--mut);
  margin: 6px 0 4px;
  min-height: 16px;
}

/* Inline scan feedback (below camera in scan panel) */
.scan-feedback {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  border-left: 3px solid;
  animation: toast-in 0.2s ease;
}
.scan-feedback.ok   { background: var(--ok-soft);   color: var(--ok);   border-left-color: var(--ok); }
.scan-feedback.err  { background: var(--bad-soft);  color: var(--bad);  border-left-color: var(--bad); }
.scan-feedback.info { background: var(--acc-soft);  color: var(--acc);  border-left-color: var(--acc); }

/* -------- QR present-mode overlay -------- */

.qr-present {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: pointer;
}
.qr-present-title { color: #111; font: 700 26px/1.2 Inter; margin-bottom: 20px; text-align: center; }
.qr-present-sub   { color: #666; font: 500 14px Inter; margin-top: 24px; }

/* -------- Mobile -------- */

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); padding: 12px; }
  .content { padding: 20px 16px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head-actions { flex-wrap: wrap; }
  .customer-row { grid-template-columns: 1fr 1fr 60px; }
  .customer-row .cust-rewards { display: none; }
}
