:root {
  --orange: #f97316;
  --orange-dark: #ea580c;
  --navy: #0b1f3a;
  --navy-deep: #071529;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; color: var(--ink); background: var(--bg); }
.muted { color: var(--muted); }
.error { color: #dc2626; font-size: .85rem; margin-top: .5rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: none; border-radius: 9px; padding: .6rem 1.1rem; font: inherit; font-weight: 700; cursor: pointer; transition: .15s; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-outline { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost { background: rgba(255,255,255,.1); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.2); }
.btn-block { width: 100%; }

/* Brand */
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 900; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--orange); border-radius: 9px; font-size: 1.1rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1; font-size: 1rem; }
.brand-text small { font-size: .52rem; letter-spacing: .16em; color: #cbd5e1; font-weight: 600; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(120% 120% at 0 0, #14375f, var(--navy-deep)); padding: 1rem; }
.login-card { background: #fff; border-radius: 16px; padding: 2rem; width: min(380px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card .brand { margin-bottom: 1.2rem; }
.login-card .brand-text small { color: var(--muted); }
.login-card h1 { font-size: 1.5rem; }
.login-card .muted { font-size: .88rem; margin-bottom: 1.2rem; }
label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .9rem; }
label input, label textarea { display: block; width: 100%; margin-top: .35rem; padding: .7rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; box-sizing: border-box; resize: vertical; }
label input:focus, label textarea:focus { outline: 2px solid var(--orange); border-color: transparent; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
label.check input { width: auto; margin: 0; }

/* Admin layout */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy-deep); color: #fff; padding: 1.4rem 1rem; display: flex; flex-direction: column; }
.side-nav { display: flex; flex-direction: column; gap: .3rem; margin-top: 2rem; flex: 1; }
.side-nav a { padding: .7rem .8rem; border-radius: 9px; color: #cbd5e1; font-weight: 600; font-size: .9rem; cursor: pointer; }
.side-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav a.active { background: var(--orange); color: #fff; }
.logout { margin-top: 1rem; }

.content { padding: 1.6rem 2rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.topbar h1 { font-size: 1.5rem; }
.who { color: var(--muted); font-size: .85rem; }
.hidden { display: none; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 1.3rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 4px 14px rgba(15,23,42,.05); }
.stat-ico { font-size: 1.8rem; }
.stat-card strong { font-size: 1.6rem; }
.stat-card p { color: var(--muted); font-size: .82rem; }

/* View head */
.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.view-head h2 { font-size: 1.15rem; }
.head-actions { display: flex; gap: .6rem; }
.head-actions input { padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 4px 14px rgba(15,23,42,.05); }
.data-table th, .data-table td { text-align: left; padding: .8rem 1rem; font-size: .88rem; border-bottom: 1px solid var(--line); }
.data-table th { background: #f8fafc; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.data-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: .8rem; }
.link { background: none; border: none; color: var(--orange); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.link.danger { color: #dc2626; }
.pill { background: #fee2e2; color: #b91c1c; font-size: .7rem; font-weight: 700; padding: .2rem .5rem; border-radius: 6px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(7,21,41,.55); display: grid; place-items: center; padding: 1rem; z-index: 100; }
.modal-overlay.hidden { display: none; }
.modal { background: #fff; border-radius: 16px; width: min(440px, 100%); max-height: 90vh; overflow: auto; }
.modal-wide { width: min(920px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); }
.modal-body { padding: 1.4rem; }
.modal-actions { display: flex; gap: .7rem; justify-content: flex-end; margin-top: .5rem; }

.storage-note { font-size: .82rem; margin: -.5rem 0 1rem; }
.batch-intro { font-size: .88rem; margin-bottom: 1rem; }
.batch-actions-top { margin-bottom: 1rem; }
.batch-row {
  display: grid;
  grid-template-columns: 72px 1.4fr 1.2fr 100px 100px auto;
  gap: .6rem;
  align-items: start;
  padding: .85rem;
  margin-bottom: .6rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.batch-row input[type="text"], .batch-row input[type="number"] {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: .85rem;
}
.batch-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: #fff;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 1.4rem;
  cursor: pointer;
  position: relative;
}
.batch-thumb img { width: 100%; height: 100%; object-fit: cover; }
.batch-thumb input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.batch-remove { background: none; border: none; color: #dc2626; font-size: 1.1rem; cursor: pointer; padding: .4rem; align-self: center; }
.promo-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: #f1f5f9; }

@media (max-width: 860px) {
  .batch-row { grid-template-columns: 1fr 1fr; }
  .batch-thumb { grid-column: span 1; }
}

/* Scan & Reward */
.scan-cta { margin-top: auto; margin-bottom: .6rem; }
.qr-reader { width: 100%; max-width: 320px; margin: 0 auto 1rem; border-radius: 12px; overflow: hidden; }
.scan-result label { margin-top: .8rem; }
.scan-member { font-size: 1.05rem; margin-bottom: .2rem; }
.scan-success { color: var(--orange); font-weight: 700; background: #fff7ed; border: 1px solid #fed7aa; padding: .8rem; border-radius: 10px; }
.scan-manual { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.scan-manual input { width: 100px; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; }

@media (max-width: 760px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side-nav { flex-direction: row; flex-wrap: wrap; margin: 0; }
  .logout { margin: 0; }
}
