/* ── VARIABLES ─────────────────────────────────────────────────────────────── */
:root {
  --primary:   #009BBE;
  --dark-blue: #00587A;
  --pink:      #DF1B79;
  --green:     #B9CA00;
  --bg:        #F0F4F8;
  --white:     #FFFFFF;
  --text:      #1a1a1a;
  --muted:     #6b7280;
  --border:    #e5e7eb;
  --shadow:    0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.14);
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 20px;
}

/* ── RESET ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Quicksand', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
button { font-family: 'Quicksand', sans-serif; cursor: pointer; }
input, select, textarea { font-family: 'Quicksand', sans-serif; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
#app { min-height: 100vh; min-height: 100dvh; }

/* ── ICONS ─────────────────────────────────────────────────────────────────── */
.icon { font-family: 'Material Symbols Rounded'; font-size: 22px; line-height: 1; user-select: none; }

/* ── GRADIENT BG ───────────────────────────────────────────────────────────── */
.grad {
  background: linear-gradient(145deg, var(--primary) 0%, var(--dark-blue) 100%);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── LOGIN ─────────────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100vh;
  min-height: 100dvh;
}
.login-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 36px 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: fadeDown .4s ease both;
}
.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-logo img { height: 72px; width: auto; }
.login-logo h1 { font-size: 17px; font-weight: 700; color: var(--primary); text-align: center; line-height: 1.3; }

/* ── FIELDS ────────────────────────────────────────────────────────────────── */
.field { position: relative; margin-bottom: 14px; }
.field-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--primary); pointer-events: none;
}
.field-icon .icon { font-size: 20px; }
.field-input {
  width: 100%; padding: 13px 42px 13px 44px;
  border: 1.5px solid var(--border); border-radius: var(--r);
  font-size: 15px; font-weight: 500; background: #f9fafb;
  transition: border-color .2s, background .2s; color: var(--text);
}
.field-input:focus { outline: none; border-color: var(--primary); background: var(--white); }
.field-suffix {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); display: flex; padding: 4px;
}
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; display: block; }
.field-plain {
  width: 100%; padding: 13px 16px;
  border: 1.5px solid var(--border); border-radius: var(--r);
  font-size: 15px; font-weight: 500; background: #f9fafb;
  transition: border-color .2s; color: var(--text);
}
.field-plain:focus { outline: none; border-color: var(--primary); background: var(--white); }

/* ── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 20px; border: none; border-radius: var(--r);
  font-size: 14px; font-weight: 700; letter-spacing: .4px;
  transition: opacity .2s, transform .1s; position: relative;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-primary  { background: var(--primary); color: var(--white); }
.btn-pink     { background: var(--pink);    color: var(--white); }
.btn-outline  { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-ghost    { background: transparent; color: var(--muted); }
.btn-danger   { background: #ef4444; color: var(--white); }
.btn-sm { padding: 9px 16px; font-size: 13px; width: auto; border-radius: var(--r-sm); }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.btn .icon { font-size: 20px; }

/* ── APPBAR ────────────────────────────────────────────────────────────────── */
.appbar {
  background: var(--white);
  display: flex; align-items: center; gap: 4px;
  padding: 0 8px 0 4px;
  height: 56px;
  box-shadow: 0 1px 0 var(--border);
  position: sticky; top: 0; z-index: 100;
}
.appbar-title {
  flex: 1; font-size: 17px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px;
}
.appbar-sub { font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 1px; }
.appbar-btn {
  background: none; border: none; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  transition: background .15s; flex-shrink: 0;
}
.appbar-btn:hover { background: rgba(0,0,0,.05); }
.appbar-btn .icon { font-size: 24px; }

/* ── DASHBOARD ─────────────────────────────────────────────────────────────── */
.dash-screen {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px 40px;
}
.dash-logout {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,.18); border: none; border-radius: 50%;
  width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  color: var(--white); transition: background .2s;
}
.dash-logout:hover { background: rgba(255,255,255,.28); }
.dash-logout .icon { font-size: 22px; }
.logo-circle {
  width: 104px; height: 104px; background: var(--white); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  animation: fadeDown .4s ease both;
}
.logo-circle img { height: 74px; width: auto; }
.dash-greeting {
  font-size: 22px; font-weight: 700; color: var(--white);
  margin: 20px 0 36px; text-align: center;
  animation: fadeUp .4s ease .1s both;
}
.dash-buttons {
  display: flex; flex-direction: column; gap: 14px;
  width: 100%; max-width: 340px;
}
.dash-btn {
  background: var(--white); border: none; border-radius: var(--r-xl);
  padding: 18px 20px; display: flex; align-items: center; gap: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  transition: transform .15s, box-shadow .15s; text-align: left; width: 100%;
}
.dash-btn:nth-child(1) { animation: bounceUp .5s ease .1s both; }
.dash-btn:nth-child(2) { animation: bounceUp .5s ease .2s both; }
.dash-btn:nth-child(3) { animation: bounceUp .5s ease .3s both; }
.dash-btn:nth-child(4) { animation: bounceUp .5s ease .4s both; }
.dash-btn:active { transform: scale(.97); box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.dash-btn-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dash-btn-icon .icon { font-size: 26px; color: var(--white); }
.dash-btn-label { font-size: 15px; font-weight: 700; color: var(--text); }

/* ── SCREEN CONTAINER ──────────────────────────────────────────────────────── */
.screen { min-height: 100vh; min-height: 100dvh; background: var(--bg); }

/* ── EVENT CARD ─────────────────────────────────────────────────────────────── */
.event-card {
  background: var(--white); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 16px;
  cursor: pointer; transition: transform .15s;
  position: relative;
}
.event-card:active { transform: scale(.99); }
.event-card-title { font-size: 15px; font-weight: 700; margin-bottom: 5px; padding-right: 36px; }
.event-card-date { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.event-card-date .icon { font-size: 14px; }
.event-card-stats { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stat { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.stat .icon { font-size: 14px; }
.stat-green  { color: #5a6e00; }
.stat-orange { color: #c05000; }
.stat-blue   { color: var(--primary); }
.prog-bar { height: 3px; background: #e5e7eb; border-radius: 2px; margin-top: 8px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 2px; transition: width .4s ease; }
.event-menu-btn {
  position: absolute; top: 12px; right: 10px;
  background: none; border: none; color: var(--muted);
  display: flex; padding: 4px; border-radius: 50%;
}
.event-menu-btn .icon { font-size: 22px; }

/* ── POPUP MENU ────────────────────────────────────────────────────────────── */
.popup {
  position: absolute; right: 12px; top: 44px;
  background: var(--white); border-radius: var(--r);
  box-shadow: 0 4px 18px rgba(0,0,0,.16);
  z-index: 300; min-width: 190px; overflow: hidden;
}
.popup-item {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; font-size: 14px; font-weight: 600;
  background: none; border: none; width: 100%; color: var(--text);
  transition: background .15s;
}
.popup-item:hover { background: #f5f5f5; }
.popup-item.danger { color: #dc2626; }
.popup-item .icon { font-size: 20px; }

/* ── LIST VIEW ─────────────────────────────────────────────────────────────── */
.list-pad { padding: 14px; display: flex; flex-direction: column; gap: 10px; }

/* ── SEARCH BAR ─────────────────────────────────────────────────────────────── */
.search-bar {
  padding: 10px 14px; background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 56px; z-index: 99;
}
.search-wrap { position: relative; }
.search-wrap .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 20px; pointer-events: none;
}
.search-input {
  width: 100%; padding: 10px 12px 10px 42px;
  background: #f0f2f4; border: none; border-radius: var(--r);
  font-size: 14px; font-weight: 500; color: var(--text);
}
.search-input:focus { outline: none; background: #e8eaec; }

/* ── FILTER CHIPS ──────────────────────────────────────────────────────────── */
.chips-row {
  display: flex; gap: 8px; overflow-x: auto; padding: 8px 14px;
  background: var(--white); border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 14px; border: 1.5px solid var(--border); border-radius: 20px;
  font-size: 12px; font-weight: 700; background: var(--white); color: var(--muted);
  cursor: pointer; white-space: nowrap; transition: all .2s; flex-shrink: 0;
}
.chip.on { background: rgba(0,155,190,.1); border-color: var(--primary); color: var(--primary); }

/* ── SELECTION BAR ─────────────────────────────────────────────────────────── */
.sel-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: #f8f9fa;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.sel-bar strong { color: var(--primary); font-weight: 700; }
.sel-bar button { background: none; border: none; color: var(--pink); font-size: 13px; font-weight: 700; }

/* ── CHECK ITEMS ───────────────────────────────────────────────────────────── */
.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--white);
  border-bottom: 1px solid #f3f4f6; cursor: pointer; transition: background .15s;
}
.check-item.on { background: rgba(0,155,190,.04); }
.check-item:active { background: #f8f9fa; }
.checkbox {
  width: 22px; height: 22px; border: 2px solid var(--border); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s;
}
.checkbox.on { background: var(--primary); border-color: var(--primary); }
.checkbox.on::after {
  content: ''; width: 6px; height: 10px;
  border: 2px solid white; border-top: none; border-left: none;
  transform: rotate(45deg) translate(-1px,-1px);
}

/* ── AVATAR ────────────────────────────────────────────────────────────────── */
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}

/* ── LIST ITEM ─────────────────────────────────────────────────────────────── */
.li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--white);
  border-bottom: 1px solid #f3f4f6;
}
.li:last-child { border-bottom: none; }
.li-body { flex: 1; min-width: 0; }
.li-title { font-size: 14px; font-weight: 700; color: var(--text); }
.li-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.li-end { display: flex; align-items: center; gap: 4px; }

/* ── TABS ──────────────────────────────────────────────────────────────────── */
.tabs { display: flex; background: var(--white); border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; padding: 14px 8px; text-align: center;
  font-size: 13px; font-weight: 700; color: var(--muted);
  background: none; border: none; border-bottom: 2.5px solid transparent;
  transition: all .2s; cursor: pointer;
}
.tab.on { color: var(--primary); border-bottom-color: var(--primary); }

/* ── WIZARD ────────────────────────────────────────────────────────────────── */
.wizard-prog { height: 3px; background: #e5e7eb; overflow: hidden; }
.wizard-prog-fill { height: 100%; background: var(--pink); transition: width .3s ease; }
.wizard-body { padding: 20px 16px; }
.wizard-hint { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.date-sel {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--white);
  border: 1.5px solid var(--border); border-radius: var(--r);
  cursor: pointer; margin-bottom: 10px; transition: border-color .2s;
}
.date-sel:active { border-color: var(--primary); }
.date-sel .icon { color: var(--primary); font-size: 22px; flex-shrink: 0; }
.date-sel-text { font-size: 15px; font-weight: 600; }

/* ── STICKY FOOTER ─────────────────────────────────────────────────────────── */
.sticky-footer {
  position: sticky; bottom: 0; background: var(--white);
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 10px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
}

/* ── SCANNER ───────────────────────────────────────────────────────────────── */
.scanner-screen { background: #000; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.scanner-body { flex: 1; position: relative; overflow: hidden; min-height: 300px; }
#qr-reader { width: 100% !important; height: 100% !important; border: none !important; }
#qr-reader video { width: 100% !important; height: 100% !important; object-fit: cover !important; }
#qr-reader__scan_region { border: none !important; }
#qr-reader__dashboard { display: none !important; }
#qr-reader img { display: none !important; }
.scanner-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.scanner-frame { width: 230px; height: 230px; border: 2.5px solid rgba(255,255,255,.65); border-radius: 20px; }
.scanner-footer { background: rgba(0,0,0,.72); padding: 14px 20px 20px; text-align: center; }
.scanner-event { color: rgba(255,255,255,.75); font-size: 13px; }
.scanner-count { color: var(--green); font-size: 16px; font-weight: 700; margin-top: 3px; }
.scanner-manual {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 24px; background: var(--bg);
}

/* ── RESULT SHEET ──────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 1000; animation: fadeIn .2s ease;
}
.result-sheet {
  background: var(--white); border-radius: 24px 24px 0 0;
  padding: 28px 28px max(36px, env(safe-area-inset-bottom, 36px));
  width: 100%; max-width: 500px; text-align: center;
  animation: slideUp .25s ease;
}
.result-icon-wrap { font-size: 76px; margin-bottom: 10px; }
.result-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.result-name  { font-size: 18px; color: var(--muted); }
.result-extra { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── BADGE ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700;
}
.badge-green  { background: rgba(90,110,0,.12);  color: #5a6e00; }
.badge-orange { background: rgba(220,100,0,.12); color: #c05000; }
.badge-blue   { background: rgba(0,155,190,.12); color: var(--primary); }
.badge-grey   { background: rgba(0,0,0,.07);     color: var(--muted); }
.badge-pink   { background: rgba(223,27,121,.1); color: var(--pink); }

/* ── FAB ───────────────────────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 24px; right: 20px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--pink); border: none;
  box-shadow: 0 4px 18px rgba(223,27,121,.4);
  display: flex; align-items: center; justify-content: center;
  color: var(--white); transition: transform .15s; z-index: 200;
}
.fab:active { transform: scale(.94); }
.fab .icon { font-size: 28px; }

/* ── EMPTY STATE ───────────────────────────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 64px 32px; gap: 12px; text-align: center;
}
.empty .icon { font-size: 56px; color: #d1d5db; }
.empty p { color: var(--muted); font-size: 14px; }

/* ── SPINNER ───────────────────────────────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25); border-top-color: var(--white);
  animation: spin .7s linear infinite; display: inline-block;
}
.spinner-primary { border-color: rgba(0,155,190,.2); border-top-color: var(--primary); }
.load-center { display: flex; align-items: center; justify-content: center; padding: 56px; }

/* ── ERROR BANNER ──────────────────────────────────────────────────────────── */
.err-banner {
  background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--r-sm);
  padding: 10px 14px; display: flex; align-items: center; gap: 8px;
  margin-top: 12px; font-size: 13px; color: #dc2626;
}
.err-banner .icon { font-size: 18px; flex-shrink: 0; }

/* ── DIALOG ────────────────────────────────────────────────────────────────── */
.dialog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  z-index: 1000; animation: fadeIn .2s ease;
}
.dialog {
  background: var(--white); border-radius: var(--r-xl);
  padding: 24px; width: 100%; max-width: 360px;
  box-shadow: var(--shadow-lg); animation: scaleIn .2s ease;
}
.dialog-title { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.dialog-body  { font-size: 14px; color: var(--muted); margin-bottom: 20px; line-height: 1.5; }
.dialog-btns  { display: flex; gap: 10px; }

/* ── PROGRESS SEND PAGE ─────────────────────────────────────────────────────── */
.progress-screen {
  min-height: 100vh; min-height: 100dvh; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 32px; text-align: center; gap: 16px;
}
.circ-prog { position: relative; width: 90px; height: 90px; }
.circ-prog svg { transform: rotate(-90deg); }
.circ-prog-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.progress-title { font-size: 20px; font-weight: 700; }
.progress-sub   { font-size: 14px; color: var(--muted); }

/* ── SNACKBAR ──────────────────────────────────────────────────────────────── */
.snack {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2937; color: var(--white);
  padding: 12px 20px; border-radius: var(--r);
  font-size: 14px; font-weight: 600; z-index: 2000;
  box-shadow: 0 4px 16px rgba(0,0,0,.3); white-space: nowrap;
  animation: slideUp .25s ease, fadeOut .3s ease 2.5s forwards;
}

/* ── DETAIL INFO ROW ───────────────────────────────────────────────────────── */
.info-row {
  background: var(--white); padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.info-row h2 { font-size: 16px; font-weight: 700; }
.info-row p  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.inv-badge {
  background: rgba(0,155,190,.1); border-radius: 20px;
  padding: 6px 14px; font-size: 13px; font-weight: 700; color: var(--primary);
  white-space: nowrap;
}

/* ── ANIMATIONS ────────────────────────────────────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0; }                    to { opacity: 1; } }
@keyframes fadeDown  { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp    { from { opacity: 0; transform: translateY(18px);  } to { opacity: 1; transform: translateY(0); } }
@keyframes bounceUp  {
  0%   { opacity: 0; transform: translateY(28px); }
  60%  { transform: translateY(-5px); }
  80%  { transform: translateY(3px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp   { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes scaleIn   { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes fadeOut   { to { opacity: 0; } }

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (min-width: 640px) {
  .login-card { padding: 44px 40px; }
  .list-pad { padding: 18px; }
  .dash-buttons { max-width: 380px; }
}
