:root {
  --text: #F5F5F7;
  --text-secondary: rgba(245, 245, 247, 0.64);
  --text-tertiary: rgba(245, 245, 247, 0.4);
  --blue: #0A84FF;
  --green: #30D158;
  --orange: #FF9F0A;
  --red: #FF453A;
  --violet: #BF5AF2;
  --blue-bg: rgba(10, 132, 255, 0.16);
  --orange-tint-bg: rgba(255, 159, 10, 0.18);
  --orange-tint-border: rgba(255, 159, 10, 0.38);
  --green-tint-bg: rgba(48, 209, 88, 0.14);
  --red-tint-bg: rgba(255, 69, 58, 0.16);
  --violet-tint-bg: rgba(191, 90, 242, 0.16);
  --violet-tint-border: rgba(191, 90, 242, 0.36);
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.22);
  --glass-highlight: rgba(255, 255, 255, 0.45);
  --glass-shadow: rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Author CSS that sets `display` on an element (e.g. .icon-btn, .btn)
   overrides the browser's default [hidden]{display:none} rule regardless
   of selector specificity, since author styles always beat the user-agent
   stylesheet. Without this, `el.hidden = true` silently does nothing
   wherever a class also sets display. Toggle visibility with `.hidden`
   (the property/attribute), never `style.display`, and this keeps it
   working everywhere on the site. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: #000000;
  color: var(--text);
  font-family: var(--font);
}

a { color: var(--blue); }

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.app.wide { max-width: 880px; }

/* ---------- Liquid glass base ----------
   Applied to every interactive surface site-wide (buttons, icon buttons,
   the search field, cards, lists, dialogs, toast) so the effect is
   automatic on every page — no need to remember to add `glass` in markup.
   `.glass` itself stays available for one-off elements (e.g. dialogs). */

.glass, .icon-btn, .btn, .search {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 1px var(--glass-highlight),
    inset 0 -12px 20px -14px rgba(0, 0, 0, 0.5),
    0 10px 26px var(--glass-shadow);
}

.glass::before, .icon-btn::before, .btn::before, .search::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  backdrop-filter: blur(16px) saturate(170%);
  z-index: -1;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass::before, .icon-btn::before, .btn::before, .search::before {
    background: rgba(18, 19, 26, 0.86);
    backdrop-filter: none;
  }
}

/* ---------- Top nav ---------- */

#appNav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 10, 14, 0.75);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-brand { font-weight: 700; font-size: 0.95rem; flex: none; }

.nav-links { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }

.nav-link {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active { color: #fff; background: var(--blue); }
.nav-link:hover { color: var(--text); }

.nav-logout {
  flex: none;
  border: none;
  background: rgba(255, 69, 58, 0.14);
  color: var(--red);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
}

/* ---------- Headings / eyebrow ---------- */

h1 {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  line-height: 1.1;
  text-wrap: balance;
}

h2 { font-size: 1.3rem; font-weight: 700; margin: 0; }

.page-sub { margin: 0 0 22px; color: var(--text-secondary); font-size: 0.95rem; }

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 28px 0 8px 4px;
}

.section-label:first-of-type { margin-top: 0; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: none;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  color: #fff;
  --glass-bg: rgba(10, 132, 255, 0.34);
  --glass-border: rgba(120, 185, 255, 0.55);
  --glass-highlight: rgba(210, 232, 255, 0.75);
}
.btn-primary:hover { opacity: 0.92; }

.btn-ghost:hover { --glass-bg: rgba(255, 255, 255, 0.12); }

.btn-danger {
  color: var(--red);
  --glass-bg: rgba(255, 69, 58, 0.18);
  --glass-border: rgba(255, 69, 58, 0.4);
}
.btn-danger:hover { --glass-bg: rgba(255, 69, 58, 0.28); }

.btn-sm { height: 36px; padding: 0 14px; font-size: 0.85rem; border-radius: 10px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}

.icon-btn:hover { color: var(--text); }
.icon-btn.danger:hover {
  color: var(--red);
  --glass-bg: rgba(255, 69, 58, 0.2);
  --glass-border: rgba(255, 69, 58, 0.4);
}

/* ---------- Search ---------- */

.search {
  display: flex;
  align-items: center;
  height: 44px;
  border-radius: 14px;
  margin-bottom: 14px;
}

.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 100%;
  padding: 0 40px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.05rem;
  outline: none;
}

.search input::placeholder { color: var(--text-tertiary); }

.search:focus-within {
  --glass-border: rgba(120, 185, 255, 0.55);
  box-shadow: inset 0 1px 1px var(--glass-highlight), 0 0 0 3px rgba(10, 132, 255, 0.25);
}

.search .clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--text-tertiary);
  color: #06070A;
  cursor: pointer;
  z-index: 1;
}

/* ---------- Forms ---------- */

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="search"],
.field select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  outline: none;
}

.field input:focus, .field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
}

.field .hint { font-size: 0.76rem; color: var(--text-tertiary); margin-top: 6px; }

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.92rem;
  font-weight: 500;
}

.checkline input { width: 18px; height: 18px; accent-color: var(--orange); }

/* ---------- Cards / lists ---------- */

.card {
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 16px;
}

.list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  border-radius: 18px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.row:last-child { border-bottom: none; }

.row-title { font-weight: 600; font-size: 1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 0.8rem; color: var(--text-tertiary); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 999px;
  padding: 3px 8px;
  flex: none;
}

.badge-role-admin { color: var(--violet); background: var(--violet-tint-bg); border: 1px solid var(--violet-tint-border); }
.badge-role-belepteto { color: var(--blue); background: var(--blue-bg); border: 1px solid rgba(10,132,255,0.35); }
.badge-role-pultos { color: var(--orange); background: var(--orange-tint-bg); border: 1px solid var(--orange-tint-border); }
.badge-vip { color: var(--orange); background: var(--orange-tint-bg); border: 1px solid var(--orange-tint-border); }
.badge-onsite { color: var(--violet); background: var(--violet-tint-bg); border: 1px solid var(--violet-tint-border); }

/* ---------- Stat card ---------- */

.stat-card { text-align: center; padding: 22px 18px; }
.stat-label { margin: 0 0 6px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); }
.stat-value { margin: 0; font-size: 2.4rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub { margin: 7px 0 0; font-size: 0.85rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat-grid .stat-card { padding: 16px; }
.stat-grid .stat-value { font-size: 1.6rem; }

/* ---------- Empty state ---------- */

.empty { text-align: center; padding: 44px 20px; color: var(--text-secondary); }
.empty svg { color: var(--text-tertiary); margin-bottom: 10px; }
.empty p { margin: 0; font-size: 0.95rem; }
.empty .sub { font-size: 0.8rem; color: var(--text-tertiary); margin-top: 4px; }

/* ---------- Toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(28, 28, 30, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  z-index: 80;
  max-width: calc(100vw - 32px);
  text-align: center;
}

#toast.error { background: rgba(255, 69, 58, 0.92); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Dialogs ---------- */

dialog { border: none; padding: 0; background: transparent; }
dialog::backdrop { background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

.sheet { width: min(400px, calc(100vw - 40px)); border-radius: 20px; }
.sheet-body { padding: 20px; }
.sheet-body h2 { margin-bottom: 14px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.alert { width: min(300px, calc(100vw - 64px)); border-radius: 20px; text-align: center; }
.alert-body { padding: 20px 16px 16px; }
.alert-body h2 { font-size: 1.05rem; margin: 0 0 4px; }
.alert-body p { margin: 0; font-size: 0.81rem; color: var(--text-secondary); line-height: 1.4; }
.alert-actions { display: flex; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.alert-actions button {
  flex: 1; height: 46px; border: none; background: none;
  font-family: var(--font); font-size: 1.05rem; color: var(--blue); cursor: pointer;
}
.alert-actions button + button { border-left: 1px solid rgba(255, 255, 255, 0.12); }
.alert-actions button.destructive { color: var(--red); }

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .nav-links { order: 3; width: 100%; }
  h1 { font-size: 1.8rem; }
}
