:root {
  --bg: #eef2f7;
  --panel: #f8fafc;
  --panel-2: #e2e8f0;
  --text: #0b1324;
  --muted: #334155;
  --ok: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
  --line: #94a3b8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px;
  transition: width .2s ease, padding .2s ease;
  box-shadow: 2px 0 10px rgba(15, 23, 42, 0.05);
}
.sidebar.collapsed { width: 0; padding: 0; overflow: hidden; border-right: 0; }
.sidebar-top { display: flex; align-items: center; gap: 8px; }
.sidebar-top h1 { margin: 0; font-size: 22px; }
.period-box { display: grid; gap: 10px; margin: 14px 0; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
select, input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
}
.tabs { display: grid; gap: 8px; margin-top: 14px; }
.tab {
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
}
.tab.active { border-color: #3b82f6; background: #bfdbfe; color: #1e3a8a; }
.open-sidebar {
  position: fixed; left: 10px; top: 10px; z-index: 20;
  padding: 8px 12px;
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e3a8a;
  font-weight: 700;
}
.open-sidebar:hover {
  background: #bfdbfe;
  border-color: #3b82f6;
}
.hidden { display: none !important; }
.content { flex: 1; padding: 18px; overflow: auto; }
#openSidebarBtn:not(.hidden) + .content { padding-left: 64px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}
.topbar h2 { margin: 0; font-size: 34px; font-weight: 700; }
.actions { display: flex; gap: 8px; }
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .06s ease;
}
.btn:hover { background: #dbe4f1; border-color: #64748b; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: #2563eb; border-color: #1d4ed8; }
.btn-primary:hover { background: #1d4ed8; border-color: #1e40af; }
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
th, td { border-bottom: 1px solid var(--line); padding: 11px 10px; text-align: left; vertical-align: top; }
th { background: #e2e8f0; font-weight: 700; }
tbody tr:hover { background: #f1f5f9; }
th .th-row { display: flex; gap: 6px; align-items: center; }
th button.icon { background: none; border: 0; color: var(--muted); cursor: pointer; }
th.active-sort { background: #bfdbfe; }
th.active-sort .th-row { color: #1e3a8a; }
th.active-sort button.icon { color: #1e3a8a; }
.money { white-space: nowrap; }
.ok { color: var(--ok); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.money.ok, .money.bad { font-weight: 700; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  display: inline-flex; gap: 8px; align-items: center;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
  font-size: 12px; color: var(--muted); background: #dbe3ee;
}
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .35);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  width: min(860px, 95vw);
  max-height: 90vh; overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  position: relative;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}
.close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
.anchored-modal {
  position: fixed;
  width: min(540px, calc(100vw - 16px));
}
.slide-panel {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(420px, 95vw);
  background: var(--panel); border-left: 1px solid var(--line);
  z-index: 110; padding: 16px; overflow: auto;
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.18);
}
.form-grid { display: grid; gap: 10px; }
.form-grid .error { color: var(--bad); font-size: 12px; min-height: 15px; }
.inline-input { width: 100px; }
.inline-control {
  min-width: 110px;
  max-width: 140px;
  padding: 6px;
  font-size: 13px;
}
.inline-salary {
  text-align: right;
}
.inline-salary-display {
  min-width: 110px;
  text-align: right;
}
.inline-position-display {
  min-width: 110px;
  text-align: left;
}
.hidden-inline {
  display: none !important;
}
.filter-popup {
  position: fixed;
  z-index: 160;
  width: min(250px, calc(100vw - 16px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 10px;
}
.filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.link-btn {
  background: none;
  border: 0;
  color: #1d4ed8;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.floating-menu {
  position: fixed;
  z-index: 170;
  width: 170px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  gap: 6px;
}
.floating-menu .btn {
  width: 100%;
  text-align: left;
}
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.day {
  border: 1px solid var(--line); border-radius: 6px; text-align: center; padding: 8px 0; cursor: pointer;
}
.day.weekend { background: #e2e8f0; }
.day.selected { background: #1d4ed8; }
.day.today { outline: 1px solid #22c55e; }
.right { text-align: right; }

@media (max-width: 980px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .actions {
    flex-wrap: wrap;
  }
  .topbar h2 {
    font-size: 30px;
  }
  th, td {
    padding: 10px 8px;
  }
}

@media (max-width: 700px) {
  .content {
    padding: 12px;
  }
  #openSidebarBtn:not(.hidden) + .content {
    padding-left: 56px;
  }
  .btn {
    min-height: 38px;
  }
  .topbar h2 {
    font-size: 26px;
  }
}
