:root {
  --lime: #fdc318;
  --lime-bright: #ffd54d;
  --lime-dark: #dba408;
  --lime-deep: #a37100;
  --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 — styl strony pikniku (sekcja zapisów) ---------- */
#view-login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: #fafafa;
  position: relative; overflow: hidden;
}
#view-login::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(900px 700px at 10% 5%, rgba(253, 195, 24, 0.18), transparent 60%),
    radial-gradient(750px 600px at 90% 90%, rgba(255, 204, 30, 0.14), transparent 60%),
    radial-gradient(500px 420px at 55% 50%, rgba(255, 213, 77, 0.10), transparent 60%);
  animation: orbDrift 22s ease-in-out infinite alternate;
}
@keyframes orbDrift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-3%, 2%) scale(1.08); }
}
.login-col {
  position: relative; z-index: 1;
  width: min(440px, 92vw);
  padding: 20px 0;
}
.login-logo {
  display: block; width: 215px; height: auto;
  margin: 0 auto 28px;
  filter: drop-shadow(0 6px 14px rgba(10, 10, 12, 0.10));
}
.login-character {
  position: absolute; top: 64px; right: -64px;
  width: 158px; height: auto; z-index: 2;
  pointer-events: none; user-select: none;
  filter: drop-shadow(0 18px 24px rgba(10, 10, 12, 0.22));
  animation: loginCharFloat 5.5s ease-in-out infinite alternate;
  transform-origin: bottom center;
}
@keyframes loginCharFloat {
  from { transform: translateY(0) rotate(-2deg); }
  to   { transform: translateY(-10px) rotate(2deg); }
}
@media (max-width: 700px) {
  .login-character { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .login-character, #view-login::before { animation: none; }
}
.login-box {
  background: linear-gradient(180deg, #ffd54d 0%, #fdc318 100%);
  border: 1px solid rgba(218, 164, 8, 0.5);
  border-radius: 28px;
  padding: 42px 38px 34px;
  box-shadow: 0 24px 56px -22px rgba(218, 164, 8, 0.55), 0 8px 20px -8px rgba(10, 10, 12, 0.12);
  text-align: center;
  position: relative;
}
.login-box h1 {
  font-family: var(--font-display);
  font-weight: 800; letter-spacing: 0.08em;
  margin: 0 0 4px; font-size: 30px; color: #0a0a0c;
}
.login-box h1::after {
  content: ""; display: block; width: 48px; height: 4px;
  background: #0a0a0c; margin: 10px auto 0; border-radius: 2px;
}
.login-sub { color: #1a1a1d; margin: 14px 0 22px; font-weight: 500; }
.login-box input {
  width: 100%; padding: 15px 18px; font-size: 18px;
  background: #fff;
  border: 1px solid rgba(10, 10, 12, 0.08); border-radius: 12px;
  margin-bottom: 16px; font-family: var(--font-body);
  transition: border-color 200ms, box-shadow 200ms;
}
.login-box input:focus {
  outline: none; border-color: #dba408;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.55);
}
.btn.btn-login {
  width: 100%;
  border-radius: 999px;
  background: #0a0a0c; color: #fff; border: none;
  padding: 16px 28px; font-size: 16px; letter-spacing: 0.02em;
  box-shadow: 0 10px 28px -10px rgba(10, 10, 12, 0.4);
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 250ms, background 200ms;
}
.btn.btn-login:hover {
  transform: translateY(-2px);
  background: #1a1a1d;
  box-shadow: 0 16px 38px -10px rgba(10, 10, 12, 0.5);
}
.login-error { color: #c5341c; min-height: 1.2em; margin: 14px 0 0; font-weight: 700; }

/* pływające dekoracje jak na stronie pikniku */
.deco {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.deco-shape {
  position: absolute; user-select: none; pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 8px 24px rgba(10, 10, 12, 0.08));
}
.deco-yellow-1 {
  top: 8%; right: -3%; width: 280px; opacity: 0.85;
  animation: float-y 11s ease-in-out infinite alternate, drift-x 17s ease-in-out infinite alternate;
}
.deco-yellow-2 {
  top: 68%; right: 6%; width: 180px; opacity: 0.75;
  animation: float-y 9s ease-in-out infinite alternate, spin-slow 38s linear infinite;
}
.deco-yellow-3 {
  top: 56%; left: -2%; width: 90px; opacity: 0.45;
  animation: float-y 8s ease-in-out infinite alternate, spin-slow 28s linear infinite reverse;
}
.deco-dots-1 {
  top: 26%; left: 6%; width: 110px; opacity: 0.7;
  animation: float-y 10s ease-in-out infinite alternate, spin-slow 32s linear infinite;
}
@keyframes float-y {
  from { transform: translateY(-18px); }
  to   { transform: translateY(22px); }
}
@keyframes drift-x {
  from { transform: translateX(-12px); }
  to   { transform: translateX(14px); }
}
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@media (max-width: 768px) {
  .deco-yellow-1 { width: 160px; opacity: 0.6; right: -8%; }
  .deco-yellow-2 { width: 110px; opacity: 0.5; right: -8%; }
  .deco-yellow-3, .deco-dots-1 { display: none; }
  .deco-shape { animation: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .deco-shape { animation: none !important; }
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  background: var(--card);
  border-bottom: 3px solid var(--lime);
  padding: 8px 20px;
  position: sticky; top: 0; z-index: 10;
}
.brand {
  display: flex; align-items: center;
  border: none; background: none; padding: 0; cursor: pointer;
}
.brand-logo { height: 56px; width: auto; display: block; }
.counter {
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px;
  flex: 1;
}
.counter b {
  color: var(--ink); font-size: 22px;
  background: linear-gradient(180deg, transparent 58%, rgba(253, 195, 24, 0.55) 58%);
  padding: 0 3px; border-radius: 3px;
}
.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); }
.tab-icon { display: inline-flex; align-items: center; padding: 10px 12px; }

/* ---------- wykres godzinowy ---------- */
.chart-head {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 16px;
}
.chart-lasthour {
  text-align: right; white-space: nowrap;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 14px;
}
.chart-lasthour .val {
  font-family: var(--font-display); font-weight: 800;
  font-size: 26px; display: block; line-height: 1.1;
}
.chart-lasthour .lbl { font-size: 11px; color: var(--muted); font-weight: 600; }
.chart-svg { display: block; width: 100%; height: auto; }
.grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.grid-axis { stroke: #c9ccd2; stroke-width: 1.5; }
.grid-vline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 5; opacity: 0.7; }
.chart-rect { stroke: rgba(218, 164, 8, 0.6); stroke-width: 1; }
.axis-y, .axis-x { font-family: var(--font-body); font-size: 11.5px; fill: var(--muted); }
.bar-val { font-family: var(--font-display); font-weight: 700; font-size: 13px; fill: var(--ink); }
.chart-empty { color: var(--muted); padding: 26px 0; }

/* ---------- 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(--lime-dark);
  box-shadow: 0 0 0 4px rgba(253, 195, 24, 0.18);
}
.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-row.is-part { border-left: 5px solid var(--lime-dark); }
.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: linear-gradient(180deg, var(--lime-bright) 0%, var(--lime) 100%);
  color: var(--ink); border-color: rgba(218, 164, 8, 0.5);
  font-size: 20px; padding: 18px 24px; width: 100%;
  font-family: var(--font-display); font-weight: 700; letter-spacing: 0.02em;
  box-shadow: 0 12px 32px -10px rgba(253, 195, 24, 0.45);
}
.btn-go:hover { filter: brightness(0.96); transform: translateY(-1px); }
.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; }

.hl-tow {
  background: linear-gradient(180deg, transparent 55%, rgba(253, 195, 24, 0.55) 55%);
  color: var(--ink); font-weight: 600; padding: 0 2px; border-radius: 3px;
}
.g-late { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; }
.g-late-title { font-weight: 700; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.g-late .btn-go { margin-top: 12px; font-size: 17px; padding: 14px 20px; }

.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;
}
@media (min-width: 880px) {
  /* 4 kafle w rzedzie, "Dopisani" laduja pod spodem */
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat.soft-red {
  background: #fdf2f2;
  border-color: rgba(227, 6, 19, 0.22);
}
.stat.soft-red .val { color: var(--red); }
.stat.soft-red .lbl { color: #a05252; }
.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 {
  background: linear-gradient(180deg, var(--lime-bright) 0%, var(--lime) 100%);
  border-color: rgba(218, 164, 8, 0.5);
}
.stat.accent .val { color: var(--ink); }
.stat.accent .val small, .stat.accent .lbl { color: rgba(10, 10, 12, 0.6); }

.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);
  word-break: break-word;
}

/* strefa niebezpieczna — kasowanie bazy */
.danger-zone { text-align: center; margin-top: 30px; padding-bottom: 10px; }
.wipe-link {
  background: none; border: none; cursor: pointer;
  color: #b91c1c; opacity: 0.65; font-size: 13px;
  text-decoration: underline; font-family: var(--font-body);
}
.wipe-link:hover { opacity: 1; }
.wipe-form {
  margin-top: 14px; text-align: left;
  background: #fdf2f2; border: 1px solid rgba(227, 6, 19, 0.25);
  border-radius: var(--radius); padding: 16px 18px;
}
.wipe-warn { margin: 0 0 12px; font-size: 14px; color: #7f1d1d; font-weight: 600; }
.wipe-row { display: flex; gap: 10px; flex-wrap: wrap; }
.wipe-row input {
  flex: 1; min-width: 220px; padding: 11px 13px;
  border: 1px solid rgba(227, 6, 19, 0.3); border-radius: 10px;
  font-family: var(--font-body); font-size: 15px;
}
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.wipe-result { color: #b91c1c; font-weight: 700; min-height: 1.2em; margin: 10px 0 0; }
.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; }
}
