:root {
  --red: #e30613;
  --red-dark: #b80511;
  --green: #16a34a;
  --green-bg: #ecfdf3;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f6f8;
  --card: #ffffff;
  --radius: 12px;
  --font-display: "Exo 2", system-ui, sans-serif;
  --font-body: "Montserrat", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

.ic {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex: 0 0 auto;
}

/* ---------- login ---------- */
#view-login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px;
  width: min(380px, 92vw);
  text-align: center;
}
.login-box h1 {
  font-family: var(--font-display);
  font-weight: 800; letter-spacing: 0.08em;
  margin: 0 0 4px; font-size: 28px;
}
.login-box h1::after {
  content: ""; display: block; width: 48px; height: 4px;
  background: var(--red); margin: 10px auto 0; border-radius: 2px;
}
.login-sub { color: var(--muted); margin: 14px 0 22px; }
.login-box input {
  width: 100%; padding: 14px 16px; font-size: 18px;
  border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 14px; font-family: var(--font-body);
}
.login-error { color: var(--red); min-height: 1.2em; margin: 12px 0 0; font-weight: 600; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 20px;
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-family: var(--font-display);
  font-weight: 800; font-size: 20px; letter-spacing: 0.08em;
  border-left: 5px solid var(--red); padding-left: 10px;
}
.counter {
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px;
  flex: 1;
}
.counter b { color: var(--red); font-size: 22px; }
.tabs { display: flex; gap: 8px; }
.tab {
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  cursor: pointer; color: var(--ink);
}
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab-ghost { border: none; color: var(--muted); }

/* ---------- check-in page ---------- */
.page { max-width: 860px; margin: 0 auto; padding: 24px 20px 80px; }

.search-wrap {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 2px solid var(--line); border-radius: 14px;
  padding: 6px 16px;
}
.search-wrap:focus-within { border-color: var(--ink); }
.ic-search { color: var(--muted); width: 24px; height: 24px; }
#search {
  flex: 1; border: none; outline: none;
  font-size: 22px; padding: 14px 0;
  font-family: var(--font-body); background: transparent;
}
.search-clear {
  border: none; background: var(--bg); border-radius: 50%;
  width: 36px; height: 36px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.results { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.result-row {
  display: flex; align-items: center; gap: 16px;
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; cursor: pointer; text-align: left;
  font-family: var(--font-body); font-size: 16px; width: 100%;
}
.result-row:hover { border-color: var(--ink); }
.result-row.is-in { border-left: 5px solid var(--green); }
.result-main { flex: 1; min-width: 0; }
.result-name { font-size: 19px; font-weight: 700; }
.result-name .imie { font-weight: 500; }
.result-sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.result-extra { color: var(--muted); font-size: 14px; white-space: nowrap; }

.chip {
  font-size: 13px; font-weight: 700; padding: 6px 12px;
  border-radius: 999px; white-space: nowrap;
}
.chip-in { background: var(--green-bg); color: var(--green); }
.chip-warn { background: var(--amber-bg); color: var(--amber); }
.chip-muted { background: var(--bg); color: var(--muted); }

.results-footer { margin-top: 18px; text-align: center; }
.results-empty {
  text-align: center; color: var(--muted);
  padding: 30px 0 10px; font-size: 17px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-body); font-weight: 700; font-size: 16px;
  border-radius: 12px; padding: 13px 22px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  text-decoration: none;
}
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-go {
  background: var(--green); color: #fff; border-color: var(--green);
  font-size: 20px; padding: 18px 24px; width: 100%;
  font-family: var(--font-display); font-weight: 700; letter-spacing: 0.02em;
}
.btn-go:hover { filter: brightness(0.95); }
.btn-ghost { background: var(--card); }
.btn-danger-ghost { color: var(--red); border-color: #f3c2c6; background: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(22, 24, 29, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 16px;
  width: min(620px, 100%); padding: 26px 26px 22px;
}
.g-head { display: flex; align-items: flex-start; gap: 14px; }
.g-name {
  font-family: var(--font-display); font-weight: 800;
  font-size: 26px; line-height: 1.2; flex: 1;
}
.g-close {
  border: none; background: var(--bg); border-radius: 50%;
  width: 40px; height: 40px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.g-sub { color: var(--muted); margin-top: 4px; font-size: 15px; }
.g-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.g-note {
  background: var(--amber-bg); color: var(--amber);
  border-radius: 10px; padding: 12px 14px; margin-top: 14px;
  font-weight: 600; font-size: 15px;
}
.g-banner-in {
  background: var(--green-bg); color: var(--green);
  border-radius: 10px; padding: 14px 16px; margin-top: 16px;
  font-weight: 700; display: flex; align-items: center; gap: 10px;
}
.g-banner-in .when { font-family: var(--font-display); font-size: 18px; }

.g-people { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.g-person {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 16px; cursor: pointer; user-select: none;
}
.g-person input { width: 22px; height: 22px; accent-color: var(--green); cursor: pointer; }
.g-person .who { font-weight: 600; font-size: 17px; flex: 1; }
.g-person .role { color: var(--muted); font-size: 13px; }

.g-uwaga {
  width: 100%; margin-top: 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--font-body); font-size: 15px;
}
.g-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.g-summary { margin-top: 14px; font-size: 15px; color: var(--ink); line-height: 1.6; }

/* add guest form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 5px; }
.form-grid input {
  width: 100%; padding: 12px 13px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; font-family: var(--font-body);
}

/* ---------- panel ---------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat .val {
  font-family: var(--font-display); font-weight: 800; font-size: 30px;
}
.stat .val small { font-size: 17px; color: var(--muted); font-weight: 600; }
.stat .lbl { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.stat.accent .val { color: var(--red); }

.panel-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px;
}
.panel-card h2 {
  font-family: var(--font-display); font-size: 18px; margin: 0 0 6px;
}
.panel-card .muted { font-size: 14px; margin: 0 0 14px; }
.import-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.import-result { font-weight: 600; min-height: 1.2em; }

.log-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.log-table td {
  padding: 8px 10px; border-top: 1px solid var(--line);
}
.log-table td.ts { color: var(--muted); white-space: nowrap; width: 1%; }
.log-table td.act { font-weight: 700; white-space: nowrap; width: 1%; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 14px 22px; border-radius: 12px;
  font-weight: 600; font-size: 16px; z-index: 100;
  display: flex; align-items: center; gap: 10px;
  max-width: 90vw;
}
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .counter { order: 3; width: 100%; flex: none; }
  #search { font-size: 18px; }
  .form-grid { grid-template-columns: 1fr; }
}
