/* ============================================================
   Union · Nap aktivitás — design system
   Prémium dark theme · krém akcent · serif display + sans UI
   ============================================================ */

:root {
  --bg: #16150f;
  --bg-2: #1b1a13;
  --card: #211f17;
  --card-2: #26231a;
  --border: rgba(240, 230, 210, 0.09);
  --border-strong: rgba(240, 230, 210, 0.18);
  --text: #f0e6d2;
  --text-2: #b3a891;
  --text-3: #7d7462;
  --accent: #f0e6d2;
  --accent-ink: #1a1812;
  --green: #7fae7f;
  --green-bg: rgba(127, 174, 127, 0.14);
  --red: #d98d7a;
  --red-bg: rgba(217, 141, 122, 0.14);
  --amber: #d9b96a;
  --amber-bg: rgba(217, 185, 106, 0.14);
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-card: 16px;
  --radius-input: 12px;
  --radius-pill: 999px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- háttér: finom mesh glow (nem AI-lila, hanem meleg krém) ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 12% -5%, rgba(240, 230, 210, 0.07), transparent 60%),
    radial-gradient(700px 500px at 95% 12%, rgba(217, 185, 106, 0.05), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(240, 230, 210, 0.04), transparent 60%);
}

.hidden { display: none !important; }

/* ============================================================
   LOGIN GATE
   ============================================================ */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(700px 500px at 15% 0%, rgba(240, 230, 210, 0.09), transparent 55%),
    radial-gradient(600px 400px at 90% 100%, rgba(217, 185, 106, 0.07), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 32px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: gateIn 0.7s var(--ease) both;
}
@keyframes gateIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--accent), #d9cba8);
  color: var(--accent-ink);
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(240, 230, 210, 0.18);
}
.login-title {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.login-sub {
  color: var(--text-2);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-top: 2px;
}
.login-desc {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
  margin: 22px 0 20px;
}
.gbtn-wrap {
  display: flex;
  justify-content: center;
  min-height: 44px;
}
.gbtn-wrap iframe { border-radius: 12px; }
.login-warn {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-input);
  background: var(--amber-bg);
  border: 1px solid rgba(217, 185, 106, 0.25);
  color: var(--amber);
  font-size: 13px;
}
.login-foot {
  margin-top: 26px;
  color: var(--text-3);
  font-size: 12px;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: rgba(22, 21, 15, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  align-self: center;
  box-shadow: 0 0 12px rgba(240, 230, 210, 0.6);
}
.brand-name {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
}
.brand-sub {
  color: var(--text-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 6px;
  border-radius: var(--radius-pill);
  background: var(--card);
  border: 1px solid var(--border);
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-ink);
}
.user-chip .uname {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.user-chip .urole {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* kijelentkezés gomb: látható felirat + ikon */
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
}
.btn-logout svg { width: 16px; height: 16px; }
.logout-label { font-size: 12.5px; font-weight: 600; }
@media (max-width: 480px) {
  .logout-label { display: none; }  /* mobilon csak ikon, title attr segít */
}

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s, color 0.18s, border-color 0.18s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn svg { width: 19px; height: 19px; }

.main {
  flex: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px calc(120px + env(safe-area-inset-bottom));
}

/* ---- nézetek ---- */
.view { display: none; }
.view.active { display: block; animation: viewIn 0.4s var(--ease); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.view-head { margin-bottom: 18px; }
.view-head h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.view-head .sub {
  color: var(--text-2);
  font-size: 13.5px;
  margin-top: 4px;
}

/* ---- kártyák ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h3, .card h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
}
.card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-2);
}

/* ============================================================
   NAPLÓ / FORM
   ============================================================ */
.date-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, var(--card-2), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.date-card .dt-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-3);
  white-space: nowrap;
}
.date-card input[type="date"] {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
  padding: 6px 0;
  outline: none;
}
.date-card input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85) sepia(0.2);
  cursor: pointer;
}
.exists-chip {
  font-size: 12px;
  color: var(--amber);
  background: var(--amber-bg);
  border: 1px solid rgba(217, 185, 106, 0.25);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  white-space: nowrap;
  animation: pulseIn 0.4s var(--ease);
}
@keyframes pulseIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.dij-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 640px) {
  .dij-grid { grid-template-columns: 1fr; }
}
.dij-card { position: relative; overflow: hidden; }
.dij-card::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 230, 210, 0.07), transparent 70%);
  pointer-events: none;
}
.dij-input-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
}
.dij-input-wrap input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  outline: none;
  letter-spacing: -0.01em;
}
.dij-input-wrap input::placeholder { color: var(--text-3); }
.dij-input-wrap .suffix {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
}
.hint {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
}
.hint b { color: var(--text-2); font-weight: 600; }

/* stepperek */
.counters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
@media (max-width: 640px) {
  .counters { grid-template-columns: 1fr; }
}
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
}
.stepper .st-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  line-height: 1.3;
}
.stepper .st-label svg { width: 17px; height: 17px; color: var(--text-3); flex-shrink: 0; }
.stepper .st-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.st-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s var(--ease), background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.st-btn:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.st-btn:active { transform: scale(0.85); }
.st-value {
  min-width: 40px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.st-value .st-input {
  width: 52px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  padding: 5px 4px;
  outline: none;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
  appearance: textfield;
}
.st-value .st-input::-webkit-outer-spin-button,
.st-value .st-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.st-value .st-input:focus { border-color: var(--accent); }
.st-value.editing { color: var(--accent); }

/* megjegyzés */
.note-area textarea {
  width: 100%;
  min-height: 90px;
  margin-top: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
.note-area textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 230, 210, 0.12);
}
.note-area textarea::placeholder { color: var(--text-3); }

/* mentés gomb */
.save-wrap {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.btn-primary {
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  padding: 15px 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 8px 24px rgba(240, 230, 210, 0.14);
  transition: transform 0.18s var(--ease), box-shadow 0.18s, filter 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(240, 230, 210, 0.2); filter: brightness(1.04); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-primary svg { width: 19px; height: 19px; }
.btn-primary.btn-lg { padding: 17px 30px; font-size: 16px; }
.btn-primary.btn-success {
  background: var(--green);
  color: #12180f;
}
.save-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* siker checkmark */
.check-draw {
  width: 46px; height: 46px;
  margin: 0 auto 8px;
  display: block;
}
.check-draw circle {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.4;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: drawCircle 0.55s var(--ease) forwards;
}
.check-draw path {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: drawCheck 0.4s 0.5s var(--ease) forwards;
}
@keyframes drawCircle { to { stroke-dashoffset: 0; } }
@keyframes drawCheck { to { stroke-dashoffset: 0; } }

/* ============================================================
   ADATOK / TÁBLÁZAT
   ============================================================ */
.filter-card { padding: 16px; }
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-row + .filter-row { margin-top: 10px; }
.filter-row.dates { justify-content: flex-start; }
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.search-wrap svg {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--text-3);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 11px 16px 11px 40px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--text-3); }

.select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 11px 34px 11px 16px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a89f8e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.select:focus { border-color: var(--accent); }
.input-date {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
}
.input-date::-webkit-calendar-picker-indicator { filter: invert(0.85) sepia(0.2); cursor: pointer; }
.date-sep { color: var(--text-3); }

.btn-ghost {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn-ghost svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-ghost:active { transform: scale(0.96); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }

.data-area { position: relative; }

/* táblázat (desktop) */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow-x: auto;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
}
.table-wrap table { min-width: 1080px; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-2);
  position: sticky;
  top: 0;
}
.data-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-2);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: rgba(240, 230, 210, 0.03); }
.data-table .num { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--text); text-align: right; white-space: nowrap; }
.data-table .sum-col { font-weight: 600; color: var(--accent); }
.data-table td.user-cell { white-space: nowrap; }
.user-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  color: var(--text);
}
.user-tag .avatar { width: 24px; height: 24px; font-size: 10px; }
.data-table .note-cell { max-width: 240px; }
.data-table .note-cell .note-click {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  color: var(--text-2);
  transition: color 0.15s;
}
.data-table .note-cell .note-click:hover { color: var(--accent); text-decoration: underline; }
.data-table .note-cell .note-click:empty::before { content: '–'; color: var(--text-3); cursor: default; }
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.row-actions .icon-btn { width: 32px; height: 32px; }
.row-actions .icon-btn svg { width: 16px; height: 16px; }
.row-actions .icon-btn.danger:hover { color: var(--red); border-color: rgba(217, 141, 122, 0.4); }

/* kártya nézet (mobil) */
.card-list { display: none; flex-direction: column; gap: 12px; }
.data-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 15px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
}
.data-card .dc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.data-card .dc-date {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.data-card .dc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 11px 12px;
  margin-bottom: 11px;
}
.data-card .dc-grid > div { display: flex; flex-direction: column; gap: 2px; }
.data-card .dc-total {
  grid-column: 1 / -1;
  flex-direction: row !important;
  align-items: baseline;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 9px;
  margin-top: 2px;
}
.data-card .dc-l {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  font-weight: 600;
}
.data-card .dc-v { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.data-card .dc-v.strong { color: var(--accent); }
.data-card .dc-counters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 11px;
}
.data-card .dc-counters span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.data-card .dc-counters svg { width: 15px; height: 15px; color: var(--text-3); }
.data-card .dc-note {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
  background: var(--bg-2);
  border-radius: var(--radius-input);
  padding: 10px 12px;
  margin-bottom: 11px;
}
.data-card .dc-actions { display: flex; gap: 8px; }
.danger-txt:hover { color: var(--red) !important; border-color: rgba(217, 141, 122, 0.4) !important; }

@media (max-width: 640px) {
  .table-wrap { display: none; }
  .card-list { display: flex; }
}
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-3);
}
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }
.empty-state .btn-ghost { margin-top: 16px; }

/* ============================================================
   KIMUTATÁSOK
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
.kpi-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 16px 14px;
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s;
}
.kpi-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.kpi-card .kpi-icon {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: rgba(240, 230, 210, 0.08);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.kpi-card .kpi-icon svg { width: 18px; height: 18px; color: var(--accent); }
.kpi-card .kpi-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-3);
  font-weight: 600;
  line-height: 1.4;
  min-height: 28px;
}
.kpi-card .kpi-value {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-card .kpi-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 3px;
}
.kpi-card .kpi-delta {
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 4px;
}
.kpi-card .kpi-delta.good { color: var(--green); }
.kpi-card .kpi-delta.bad { color: var(--red); }
.kpi-card .kpi-delta.warn { color: var(--amber); }
.kpi-card .kpi-delta svg { width: 13px; height: 13px; vertical-align: -2px; }

/* cél progress ring */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.goal-user {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
}
.goal-user .gu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.goal-user .gu-head .avatar { width: 32px; height: 32px; font-size: 12px; }
.goal-user .gu-head .gname { font-weight: 600; font-size: 14px; }
.goal-user .gu-head .gstatus { margin-left: auto; font-size: 11px; font-weight: 600; }
.gu-rows { display: flex; flex-direction: column; gap: 12px; }
.gu-row { display: flex; flex-direction: column; gap: 5px; }
.gu-row .gu-label {
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.gu-row .bar-track {
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: rgba(240, 230, 210, 0.08);
  overflow: hidden;
  position: relative;
}
.gu-row .bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(240,230,210,0.55), var(--accent));
  box-shadow: 0 0 8px rgba(240, 230, 210, 0.3);
  transition: width 0.7s var(--ease);
  min-width: 0;
}
.gu-row .bar-fill.done {
  background: linear-gradient(90deg, rgba(127,174,127,0.6), var(--green));
  box-shadow: 0 0 8px rgba(127, 174, 127, 0.35);
}
.gu-row .bar-fill.over {
  background: linear-gradient(90deg, rgba(217,185,106,0.6), var(--amber));
  box-shadow: 0 0 8px rgba(217, 185, 106, 0.35);
}
.gu-row .gu-val {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  white-space: nowrap;
}
.gu-row .gu-val .cur { color: var(--text); font-weight: 700; }
.gu-row .gu-val .sep { color: var(--text-3); }
.gu-row .gu-val .goal { color: var(--text-3); }

/* trend chart */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { transition: opacity 0.2s; }
.chart .bar:hover { opacity: 0.85; }
.legend {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  gap: 12px;
}
.legend .lg-item { display: flex; align-items: center; gap: 5px; }
.legend .lg-dot { width: 8px; height: 8px; border-radius: 2px; }

/* rangsor */
.ranking { display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
}
.rank-pos {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  width: 30px;
  color: var(--text-3);
  flex-shrink: 0;
}
.rank-row:first-child .rank-pos { color: var(--amber); }
.rank-row:nth-child(2) .rank-pos { color: var(--text-2); }
.rank-row:nth-child(3) .rank-pos { color: #a07d5c; }
.rank-row .avatar { width: 32px; height: 32px; font-size: 12px; flex-shrink: 0; }
.rank-row .rname { font-weight: 600; font-size: 14px; flex: 1; }
.rank-row .rscore { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rank-row .rscore b { color: var(--accent); font-weight: 700; }

/* ============================================================
   BEÁLLÍTÁSOK
   ============================================================ */
.admin-card { margin-bottom: 14px; }
.user-admin-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.3fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.user-admin-row:last-child { border-bottom: none; }
.ua-id { min-width: 0; }
.user-admin-row .u-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-admin-row .u-mail { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-admin-row input[type="text"], .user-admin-row input[type="email"] {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  width: 100%;
  min-width: 0;
}
.user-admin-row input:focus { border-color: var(--accent); }
.user-admin-row select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 9px 10px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
}
.ua-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-end;
}
.ua-set {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.mini-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}
.color-row { display: flex; gap: 4px; flex-wrap: wrap; max-width: 160px; }
.color-dot-pick {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}
.color-dot-pick:hover { transform: scale(1.15); }
.color-dot-pick.selected { border-color: var(--text); }

/* mobil: a felhasználó sorok kompaktan, az email teljes szélességben */
@media (max-width: 640px) {
  .user-admin-row {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 12px 0;
  }
  .user-admin-row .ua-email { grid-column: 1 / -1; grid-row: 2; }
  .user-admin-row .ua-role { grid-column: 1; grid-row: 3; justify-self: start; }
  .ua-controls { grid-column: 2; grid-row: 3; }
}

/* toggle */
.toggle {
  position: relative;
  width: 44px; height: 24px;
  border-radius: 99px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.22s var(--ease), background 0.2s;
}
.toggle.on { background: rgba(127, 174, 127, 0.35); border-color: rgba(127, 174, 127, 0.5); }
.toggle.on::after { transform: translateX(20px); background: var(--green); }

.goal-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.goal-admin-card {
  min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
}
.goal-admin-card .ga-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}
.goal-admin-card .ga-head .avatar { width: 28px; height: 28px; font-size: 11px; }
.goal-admin-card .ga-head span { font-weight: 600; font-size: 13.5px; }
.ga-fields { display: flex; flex-direction: column; gap: 10px; }
.ga-field { display: flex; flex-direction: column; gap: 4px; }
.ga-field label {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.3;
}
.ga-field input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  text-align: left;
  transition: border-color 0.2s;
}
.ga-field input:focus { border-color: var(--accent); }
.ga-field input::placeholder { color: var(--text-3); }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 640px) {
  .modal { align-items: center; }
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 9, 6, 0.66);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  animation: modalUp 0.35s var(--ease);
}
@media (min-width: 640px) {
  .modal-card { border-radius: 22px; }
}
@keyframes modalUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h3 { font-family: var(--font-serif); font-size: 19px; font-weight: 600; }
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  justify-content: flex-end;
}
.modal-body .dij-grid { margin-bottom: 14px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  z-index: 300;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(127, 174, 127, 0.4); }
.toast.err { border-color: rgba(217, 141, 122, 0.4); }

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottomnav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  gap: 4px;
  padding: 7px;
  border-radius: var(--radius-pill);
  background: rgba(33, 31, 23, 0.85);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
.nav-tab {
  border: none;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
  min-width: 74px;
}
.nav-tab svg { width: 21px; height: 21px; transition: transform 0.25s var(--ease); }
.nav-tab:active { transform: scale(0.92); }
.nav-tab.active {
  color: var(--accent);
  background: rgba(240, 230, 210, 0.09);
}
.nav-tab.active svg { transform: translateY(-1px) scale(1.06); }

/* desktop: a nav a topbar alá kerül inline-ként */
@media (min-width: 900px) {
  .bottomnav {
    position: static;
    transform: none;
    order: 3;
    margin: 0 auto 26px;
    box-shadow: none;
  }
  .nav-tab { flex-direction: row; gap: 7px; padding: 9px 20px; }
  .nav-tab svg { width: 18px; height: 18px; }
  .main { padding-bottom: 40px; }
}

/* ============================================================
   REVEAL + MISC
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }

.spinner {
  width: 26px; height: 26px;
  border: 2.5px solid rgba(240, 230, 210, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(240, 230, 210, 0.14); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
