:root {
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #f1f3f7;
  --border: #e4e7ee;
  --text: #1c2230;
  --muted: #6b7384;
  --accent: #4f46e5;
  --accent-ink: #fff;
  --accent-soft: #eef0fe;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #b45309;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20,28,46,.04), 0 6px 20px rgba(20,28,46,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
#app { min-height: 100%; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

/* ---- ikon-gombok ---- */
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: 16px; line-height: 1; transition: .13s;
}
.icon-btn svg { width: 18px; height: 18px; display: block; }
/* szövegközi (nem gomb) ikonok: a szöveghez igazítva, visszafogottan */
.lbl svg, .meta svg, .count svg, .type-line svg, .chg-line svg, .rec-row svg, .res-row svg,
.inv-name svg, .inv-sub svg, .chip svg, .btn-wide svg, .seg-btn svg, .leg svg,
.scan-actions .btn svg, .result svg, .err-list svg { width: 15px; height: 15px; flex: none; vertical-align: -3px; }
.stat .lbl svg { width: 13px; height: 13px; vertical-align: -2px; }
.dash-h svg { width: 16px; height: 16px; vertical-align: -3px; color: var(--accent); }
.btn-wide svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: #d4d8e1; }
.icon-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.icon-btn.primary:hover { background: #4338ca; border-color: #4338ca; color: #fff; }
.icon-btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- elrendezés ---- */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(255,255,255,.82); backdrop-filter: blur(10px); z-index: 5;
}
.bar .brand { font-weight: 650; letter-spacing: -.01em; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.bar .brand svg { color: var(--accent); }
.bar .spacer { flex: 1; }
.wrap { max-width: 920px; margin: 0 auto; padding: 22px 18px 60px; }

/* ---- login ---- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; width: 100%; max-width: 380px;
}
.logo { font-size: 22px; font-weight: 700; letter-spacing: -.02em; text-align: center; margin: 4px 0 4px; display: flex; align-items: center; justify-content: center; gap: 9px; }
.logo svg { color: var(--accent); }
.sub { color: var(--muted); text-align: center; margin: 0 0 20px; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); }
.input, .input:focus {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); outline: none;
}
.input:focus { border-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; }
.btn-wide {
  width: 100%; padding: 12px; border-radius: 12px; border: none;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-wide:disabled { opacity: .6; cursor: not-allowed; }
.otp-input { text-align: center; letter-spacing: 8px; font-size: 22px; }

/* ---- esemény-lista ---- */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.event {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: .13s;
  box-shadow: var(--shadow);
}
.event:hover { border-color: #c7c9f5; box-shadow: 0 2px 4px rgba(20,28,46,.05), 0 10px 28px rgba(79,70,229,.10); }
.event h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600; width: fit-content; }
.badge.draft { background: #fdf2e3; color: var(--warn); }
.badge.live { background: #e7f6ec; color: var(--ok); }
.badge.closed { background: var(--surface-2); color: var(--muted); }
.count { display: inline-flex; align-items: center; gap: 5px; }

.empty { text-align: center; color: var(--muted); padding: 56px 20px; }
.empty .big { margin-bottom: 12px; display: flex; justify-content: center; color: #c2c7d2; }
.empty .big svg { width: 40px; height: 40px; }

/* ---- szerkesztő (drawer) ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%);
  background: var(--surface); border-left: 1px solid var(--border); z-index: 11;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.drawer .bar { background: var(--surface); position: static; }
.drawer .body { overflow-y: auto; padding: 20px; flex: 1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.swatch { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border); padding: 0; background: none; }
.section { margin: 6px 0; border: 1px solid var(--border); border-radius: 12px; padding: 4px 12px; }
.section > summary { cursor: pointer; padding: 8px 0; font-weight: 600; font-size: 14px; color: var(--muted); list-style: none; }
.section[open] > summary { color: var(--text); margin-bottom: 6px; }
.section > summary::-webkit-details-marker { display: none; }

/* ---- toast ---- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: .25s; z-index: 20; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--danger); }

/* ---- meghívott-lista ---- */
.event-top { display: flex; align-items: center; justify-content: space-between; }
.icon-btn.ghost { width: 34px; height: 34px; font-size: 15px; background: transparent; border-color: transparent; }
.icon-btn.ghost:hover { background: var(--surface-2); }
.inv-head { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.inv-list { display: flex; flex-direction: column; gap: 8px; }
.inv-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
.inv-main { flex: 1; min-width: 0; }
.inv-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.inv-lang { font-size: 10px; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.inv-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-tags { display: flex; gap: 6px; flex-shrink: 0; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag.rsvp-yes { background: #e7f6ec; color: var(--ok); }
.tag.rsvp-no { background: #fdeaea; color: var(--danger); }
.tag.rsvp-maybe { background: #fdf2e3; color: var(--warn); }
.tag.in { background: var(--accent-soft); color: var(--accent); }
.inv-acts { display: flex; gap: 2px; flex-shrink: 0; }

/* ---- import / űrlap extra ---- */
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin-top: 6px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.file-drop {
  display: grid; place-items: center; padding: 22px; border: 1px dashed var(--border);
  border-radius: 12px; color: var(--muted); cursor: pointer; transition: .15s;
}
.file-drop:hover { border-color: var(--accent); color: var(--text); }
textarea.input { resize: vertical; font-family: ui-monospace, monospace; font-size: 13px; }
.result { margin-top: 16px; padding: 14px; background: var(--surface-2); border-radius: 12px; display: flex; flex-direction: column; gap: 6px; }
.result .big { font-weight: 700; margin-bottom: 4px; }
.err-list { color: var(--warn); font-size: 13px; margin-top: 6px; line-height: 1.6; }

/* ---- üzenetek ---- */
.msg-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.msg-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.msg-top { display: flex; align-items: center; gap: 10px; }
.msg-ico { color: var(--accent); display: inline-flex; }
.msg-ico svg { width: 20px; height: 20px; }
.msg-title { font-weight: 600; font-size: 16px; }
.sched-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px 4px 4px 10px; font-size: 13px; color: var(--warn); }
.msg-acts { display: flex; gap: 6px; margin-top: 4px; }
.msg-acts .icon-btn { flex: 0 0 auto; }
.msg-acts .icon-btn.primary { margin-left: auto; }

.drawer.wide { width: min(620px, 100%); }
.tabs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--border); }
.tab { background: transparent; border: 1px solid transparent; border-bottom: none; color: var(--muted); padding: 8px 16px; border-radius: 10px 10px 0 0; }
.tab.on { background: var(--surface-2); color: var(--text); border-color: var(--border); }

/* ---- beléptető ---- */
.scanner { max-width: 460px; }
.stats { display: flex; gap: 10px; margin-bottom: 14px; }
/* Beléptetőben a statisztika ragadjon a fejléc alá (mobilon mindig látszik a bent/belépett szám). */
.scanner .stats { position: sticky; top: 51px; z-index: 4; margin: -6px -2px 14px; padding: 8px 2px; background: var(--bg); }
.stat { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 12px; text-align: center; box-shadow: var(--shadow); }
.stat .num { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
/* ---- esemény-áttekintő (dashboard) ---- */
.dash { display: flex; flex-direction: column; gap: 14px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
/* ---- előnézet-modal ---- */
.preview-modal { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--surface); }
.preview-modal .bar { background: var(--surface); }
.preview-frame { flex: 1; width: 100%; border: 0; background: #fff; }

/* ---- mód-váltó (segment) ---- */
.act-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex: none; }
.act-ico svg { width: 16px; height: 16px; }
.log-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.log-meta .log-at { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rsvp-edit { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); }
.add-row { display: flex; gap: 8px; align-items: stretch; }
.add-row .input { flex: 1; }
.seg { display: flex; gap: 6px; padding: 12px 16px 0; }
.seg-btn { flex: 1; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.seg-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; white-space: pre; }

.dash-h { font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.dash-h-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dash-h-row .icon-btn { margin: -6px -4px -6px 0; }
.rsvp-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.rsvp-seg { height: 100%; }
.rsvp-seg.yes { background: var(--ok); }
.rsvp-seg.maybe { background: var(--warn); }
.rsvp-seg.no { background: var(--danger); }
.rsvp-seg.none { background: var(--border); }
.rsvp-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; }
.leg { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.leg .dot { width: 9px; height: 9px; border-radius: 50%; }
.leg .dot.yes { background: var(--ok); } .leg .dot.maybe { background: var(--warn); }
.leg .dot.no { background: var(--danger); } .leg .dot.none { background: var(--border); }
.leg .dot.guest { background: var(--accent); }
.type-lines { display: flex; flex-direction: column; gap: 6px; }
.type-line { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 7px 11px; background: var(--surface-2); border-radius: 9px; }
.chg-lines { display: flex; flex-direction: column; gap: 6px; }
.chg-line { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 8px 11px; background: var(--surface-2); border-radius: 9px; }
.chg-ico { flex: none; }
.chg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chg-at { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tag.warn { background: #fdf2e3; color: var(--warn); }
.cam { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 1; display: grid; place-items: center; }
.cam video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.7); border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.25); pointer-events: none; }
.cam-msg { position: absolute; color: #fff; font-size: 14px; text-align: center; padding: 0 24px; }
.search-box { display: flex; gap: 8px; margin: 14px 0 10px; flex-wrap: wrap; }
.search-box .input { flex: 1; min-width: 180px; }
.chip { padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.search-results { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.res-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; cursor: pointer; transition: .12s; }
.res-row:hover { border-color: var(--accent); }
.res-row .res-go { color: var(--muted); font-weight: 800; }
.confirm-card { background: var(--surface); border: 1px solid var(--accent); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.cc-name { font-weight: 700; font-size: 18px; }
.cc-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cc-state { margin: 10px 0; }
.scan-actions { display: flex; gap: 10px; margin-top: 8px; }
.scan-actions .btn { flex: 1; padding: 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 15px; }
.scan-actions .act-in.sug { background: var(--ok); border-color: var(--ok); color: #04130d; }
.scan-actions .act-out.sug { background: var(--warn); border-color: var(--warn); color: #1a1402; }
.recent { display: flex; flex-direction: column; gap: 6px; }
.rec-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.rec-row .dir { font-weight: 800; }
.rec-row.in .dir { color: var(--ok); } .rec-row.out .dir { color: var(--warn); }
.rec-row .rn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-row .rec-op { color: var(--muted); font-size: 12px; white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.rec-row .rt { color: var(--muted); font-size: 12px; }

.spin { width: 18px; height: 18px; border: 2px solid rgba(28,34,48,.15); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
.btn-wide .spin, .icon-btn.primary .spin { border-color: rgba(255,255,255,.45); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }
