:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #6b7684;
  --line: #e2e6ec;
  --brand: #1f4e79;
  --brand-ink: #ffffff;
  --accent: #2f7dd1;
  --danger: #c0392b;
  --warn-bg: #fff4e5;
  --warn-ink: #9a5b00;
  --weekend: #f7f8fa;
  --miluim: #e6f0e1; --miluim-ink: #3d6b2a;
  --holiday: #e8eefc; --holiday-ink: #2f4fa3;
  --sick: #fdeaea; --sick-ink: #a43535;
  --other: #f1ecf9; --other-ink: #5d3f94;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Hebrew", Arial, sans-serif;
  background: var(--bg); color: var(--ink);
}
[hidden] { display: none !important; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px;
  background: var(--brand); color: var(--brand-ink);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
nav { display: flex; gap: 4px; flex: 1; }
nav a {
  color: #cfe0f1; text-decoration: none; padding: 7px 12px; border-radius: 6px; font-weight: 500;
}
nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
nav a.active { color: #fff; background: rgba(255,255,255,.16); }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.who .link { color: #cfe0f1; }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .spacer { flex: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.grid-2 > * { min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } nav { overflow-x: auto; flex-basis: 100%; order: 3; } .stats { grid-template-columns: repeat(3, 1fr); } .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px; } main { padding: 14px; } }

/* forms */
label { display: block; font-size: 13px; font-weight: 600; color: #3a4552; margin: 0 0 4px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; }
.row > .field { flex: 1; }
input, select, textarea {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #cbd3dd; border-radius: 7px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b9d4f1; border-color: var(--accent); }
textarea { resize: vertical; min-height: 56px; }
button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 7px; padding: 8px 14px;
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
}
button:hover { filter: brightness(1.08); }
button.secondary { background: #fff; color: var(--brand); border-color: #c4d2e1; }
button.danger { background: #fff; color: var(--danger); border-color: #ecc4c0; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 4px 0; }

/* month switcher */
.month-nav { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.month-nav button { background: none; border: 0; color: var(--ink); padding: 6px 12px; font-size: 18px; line-height: 1; }
.month-nav span { min-width: 140px; text-align: center; font-weight: 600; }
.inline-select { width: auto; min-width: 220px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat.warn { background: var(--warn-bg); border-color: #f3d7a8; }
.stat.warn .v { color: var(--warn-ink); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #f0f6fd; }
tr.weekend td { background: var(--weekend); color: var(--muted); }
tr.missing td:first-child { box-shadow: inset 3px 0 0 #e8a33d; }
tr.selected td { background: #e3effb !important; }
tfoot td { font-weight: 700; background: #fafbfc; border-top: 2px solid var(--line); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag.miluim { background: var(--miluim); color: var(--miluim-ink); }
.tag.holiday { background: var(--holiday); color: var(--holiday-ink); }
.tag.sick { background: var(--sick); color: var(--sick-ink); }
.tag.other { background: var(--other); color: var(--other-ink); }
.tag.missing { background: var(--warn-bg); color: var(--warn-ink); }
.tag.inactive { background: #eceff3; color: var(--muted); }
.tag.admin { background: #e3effb; color: var(--brand); }

/* login */
.login-wrap { min-height: calc(100vh - 48px); display: grid; place-items: center; }
.login { width: 360px; }
.login h1 { margin-bottom: 4px; }
.login p { margin: 0 0 18px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1b2430; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.toast.err { background: var(--danger); }

.print-only { display: none; }
@media print {
  body.print-detail main > *:not(#detail) { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .topbar, .no-print, .toast { display: none !important; }
  .print-only { display: block; }
  main { padding: 0; max-width: none; }
  .card { border: 0; padding: 0; }
  .stat { border: 1px solid #ccc; }
  th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
