:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e4e7ec;
  --text: #101828;
  --muted: #667085;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-soft: #eef2ff;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --gray-soft: #f1f3f6;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f19; --surface: #131926; --surface-2: #1b2230; --border: #262f3f;
    --text: #e6e9ef; --muted: #94a0b4; --primary: #7c7cf5; --primary-600: #6366f1;
    --primary-soft: #1e2138; --green:#4ade80; --green-soft:#14331f; --amber:#fbbf24;
    --amber-soft:#3a2c0a; --red:#f87171; --red-soft:#3a1616; --gray-soft:#1b2230;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 15px; width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 14px;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--primary-600); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.subtle { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--red); }
.btn.danger:hover { filter: brightness(.92); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.green { background: var(--green); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.brand .logo { font-size: 26px; }
.brand small { font-weight: 500; color: var(--muted); }
.auth-card h1 { font-size: 20px; margin: 22px 0 4px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-switch button { background: none; border: none; color: var(--primary); font-weight: 600; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; padding: 12px 20px;
}
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft);
  color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.container { max-width: 1080px; margin: 0 auto; padding: 22px 20px 80px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.tabs button {
  border: none; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 8px 16px; border-radius: 9px;
}
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs .badge-count { background: var(--amber); color:#fff; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 6px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-h { padding: 16px 18px; border-bottom: 1px solid var(--border); font-weight: 700; display:flex; align-items:center; justify-content:space-between; gap: 10px;}
.card .card-b { padding: 18px; }
.grid { display: grid; gap: 18px; }
@media (min-width: 860px) { .grid.cols-2 { grid-template-columns: 340px 1fr; align-items: start; } }

.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { font-size: 13px; color: var(--muted); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.badge.pending { background: var(--amber-soft); color: var(--amber); }
.badge.approved { background: var(--green-soft); color: var(--green); }
.badge.rejected { background: var(--red-soft); color: var(--red); }
.badge.cancelled { background: var(--gray-soft); color: var(--muted); }
.badge.override { background: var(--primary-soft); color: var(--primary); }

/* ---------- Lists ---------- */
.leave-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.leave-item:last-child { border-bottom: none; }
.leave-item .who { font-weight: 600; }
.leave-item .meta { color: var(--muted); font-size: 13px; }
.leave-item .grow { flex: 1; min-width: 0; }
.leave-item .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.type-dot { width: 9px; height: 9px; border-radius: 50%; display:inline-block; }
.t-annual { background: var(--primary); }
.t-sick { background: var(--red); }
.t-unpaid { background: var(--amber); }
.t-other { background: var(--muted); }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head .title { font-size: 18px; font-weight: 700; text-transform: capitalize; }
.cal-nav { display: flex; gap: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-cell { min-height: 92px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; overflow: hidden; }
.cal-cell.out { opacity: .4; }
.cal-cell.today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.cal-cell.weekend { background: var(--surface-2); }
.cal-cell .dnum { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-cell.over .dnum { color: var(--red); }
.chip { font-size: 11px; padding: 2px 6px; border-radius: 6px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.approved { background: var(--green-soft); color: var(--green); }
.chip.pending { background: var(--amber-soft); color: var(--amber); border: 1px dashed var(--amber); }
.chip.more { color: var(--muted); }

/* ---------- Misc ---------- */
.inline-warn { background: var(--amber-soft); color: var(--amber); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.inline-ok { background: var(--green-soft); color: var(--green); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.hstack { display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; z-index: 100; box-shadow: var(--shadow); max-width: 90vw;
}
.toast.err { background: var(--red); color: #fff; }
/* ---------- Meter (szabadságkeret) ---------- */
.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter.big { height: 14px; }
.meter.mini { width: 120px; min-width: 120px; }
.meter > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .35s ease; }
.meter > i.warn { background: var(--amber); }
.meter > i.over { background: var(--red); }
.balance-num { font-weight: 800; }
.balance-num.ok { color: var(--green); }
.balance-num.warn { color: var(--amber); }
.balance-num.over { color: var(--red); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(16,24,40,.5); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 440px; box-shadow: var(--shadow); }
.modal .m-h { padding: 18px; border-bottom: 1px solid var(--border); font-weight: 700; }
.modal .m-b { padding: 18px; }
.modal .m-f { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
