@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #eef3ff;
  --bg-2: #f8fbff;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --text: #111a2b;
  --muted: #5a6578;
  --border: rgba(150, 168, 202, 0.35);
  --ring: rgba(42, 123, 255, 0.28);
  --primary: #1769ff;
  --primary-hover: #0f57d6;
  --ok-bg: #e8f9ef;
  --ok-text: #166737;
  --vac-bg: #fff5da;
  --vac-text: #8f5f00;
  --sick-bg: #ffe4e6;
  --sick-text: #a51f2d;
  --ocr-bg: #e3f0ff;
  --ocr-text: #0f4f98;
  --danger: #ca2e47;
  --shadow: 0 10px 28px rgba(24, 40, 74, 0.12);
  --shadow-soft: 0 4px 14px rgba(24, 40, 74, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 400px at -5% -5%, #cddcff 10%, transparent 70%),
    radial-gradient(850px 380px at 110% 0%, #d8f0ff 5%, transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 48%, #f9fbff 100%);
}

.app {
  max-width: 1320px;
  margin: 14px auto;
  padding: 0 12px 20px;
}

.hidden { display: none !important; }

.card {
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.app-main {
  min-width: 0;
}

h1 {
  margin: 0 0 4px;
  font-size: 30px;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.01em;
}

h3 {
  margin: 14px 0 8px;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-end;
  position: sticky;
  top: 10px;
  z-index: 5;
  margin-bottom: 12px;
}

.app-sidebar {
  position: sticky;
  top: 10px;
  padding: 14px;
  margin-bottom: 0;
}

.sidebar-brand {
  margin-bottom: 12px;
}

.sidebar-brand h1 {
  font-size: 28px;
}

.sidebar-logout {
  width: 100%;
  margin-top: 12px;
}

.app-nav {
  display: grid;
  gap: 8px;
  align-items: stretch;
  padding: 0;
}

.nav-btn {
  box-shadow: none;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
}

.nav-btn.active {
  background: linear-gradient(180deg, var(--primary), #1259e1);
  color: #fff;
  border-color: #2e6cff;
}

.app-screen {
  display: block;
}

.app-screen.hidden {
  display: none !important;
}

.login-card {
  max-width: 460px;
  margin: 24px auto;
}

.login-form {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

select,
input,
textarea,
button {
  font: inherit;
}

select,
input,
textarea {
  min-width: 150px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  transition: box-shadow 0.2s, border-color 0.2s;
}

select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: #9bbdff;
  box-shadow: 0 0 0 4px var(--ring);
}

button {
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--primary), #1259e1);
  color: #fff;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(23, 105, 255, 0.32);
  transition: transform 0.15s, filter 0.15s;
}

button:hover { filter: brightness(1.03); transform: translateY(-1px); }
button:active { transform: translateY(0); }

button.secondary {
  background: linear-gradient(180deg, #75829a, #616d84);
  box-shadow: 0 4px 10px rgba(73, 88, 115, 0.22);
}

button.danger {
  background: linear-gradient(180deg, #dd4460, var(--danger));
  box-shadow: 0 4px 10px rgba(173, 31, 57, 0.26);
}

button.btn-sm {
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: none;
}

button.btn-soft {
  background: #edf3ff;
  color: #15469f;
  border: 1px solid #c7d9ff;
}

button.btn-soft.secondary {
  background: #f2f4f7;
  color: #415069;
  border: 1px solid #d6dde8;
}

button.btn-soft.danger {
  background: #fff0f3;
  color: #a51f2d;
  border: 1px solid #ffd0d8;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}

.status-open { background: #fff4cc; color: #9a6700; }
.status-confirmed { background: #e6f7ea; color: #217a38; }

.summary,
.team-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kpi,
.mini-card {
  border: 1px solid var(--border);
  background: var(--surface-solid);
  border-radius: 12px;
  padding: 10px;
}

.kpi .label,
.mini-card .meta {
  color: var(--muted);
  font-size: 12px;
}

.kpi .value {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
}

.mini-card .name {
  font-weight: 700;
  margin-bottom: 4px;
}

.calendar-head,
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.calendar-grid-shell {
  min-width: 680px;
}

.mobile-calendar {
  display: none;
}

.mobile-calendar-nav {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 10px;
}

.mobile-day {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  margin-bottom: 8px;
  text-align: left;
  color: var(--text);
}

.mobile-day-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.mobile-date {
  font-weight: 700;
  font-size: 14px;
}

.mobile-weekday {
  color: var(--muted);
  font-size: 12px;
}

.mobile-meta {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mobile-empty {
  color: var(--muted);
  font-size: 12px;
}

.calendar-head div {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px;
}

.day {
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 96px;
  padding: 8px;
  background: #fff;
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.day:hover {
  border-color: #9fb3c8;
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.day.empty {
  opacity: 0.3;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.day-number {
  font-weight: 700;
  font-size: 15px;
}

.day-badge {
  font-size: 11px;
  border-radius: 7px;
  padding: 3px 6px;
  width: fit-content;
}

.holiday-only { background: #fff8e6; }
.holiday-line { margin-top: 4px; font-size: 11px; color: #9a6700; }
.team-vacation-line {
  margin-top: 4px;
  font-size: 10px;
  color: #475467;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.filled { border-width: 2px; }
.PRACE_CELY_DEN,
.PRACE_PUL_DEN { background: var(--ok-bg); color: var(--ok-text); }
.DOVOLENA { background: var(--vac-bg); color: var(--vac-text); }
.NEMOC { background: var(--sick-bg); color: var(--sick-text); }
.OCR { background: var(--ocr-bg); color: var(--ocr-text); }
.RODICOVSKA,
.MATERSKA { background: #eef2f7; color: #344054; }

.vac-pending { border-color: #d97706; background: #fff7ed; }
.vac-rejected { border-color: #b42318; background: #fff1f2; }
.day-badge.PENDING { border: 1px dashed #d97706; }
.day-badge.REJECTED { background: #ffe3e3; color: #b42318; }

dialog {
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(460px, 96vw);
  padding: 0;
  box-shadow: var(--shadow);
}

#dayForm {
  display: grid;
  gap: 10px;
  padding: 14px;
}

#dayForm h2 { margin: 0; }

.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-actions .right,
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#managerView h2 { margin-top: 0; }

.manager-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.employees-list { display: grid; gap: 8px; }

.employee-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface-solid);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.employee-item .actions {
  justify-content: flex-end;
}

.employee-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.table-wrap { overflow: auto; }

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface-solid);
  border-radius: 12px;
  overflow: hidden;
}

.log-table th,
.log-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px 7px;
  white-space: nowrap;
}

.log-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f9fbff;
}

.section-row td {
  background: #f2f6ff;
  color: #1f3f8f;
  font-weight: 700;
  border-top: 1px solid #d8e4ff;
}

details {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.doc-missing { color: #b42318; font-weight: 700; }
.doc-warning { color: #b54708; font-weight: 700; }

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
  }

  .app-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-logout {
    width: auto;
  }

  .summary,
  .team-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .manager-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .app-shell {
    gap: 10px;
  }

  .app-sidebar {
    padding: 12px;
  }

  .app-nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .app-nav .nav-btn {
    width: auto;
    min-width: max-content;
    white-space: nowrap;
  }

  .controls { justify-content: space-between; }
  .summary,
  .team-summary,
  .manager-grid { grid-template-columns: 1fr; }

  .calendar-wrap { display: none; }
  .mobile-calendar-nav { display: flex; }
  .mobile-calendar { display: block; }

  .day {
    min-height: 78px;
    padding: 7px;
  }

  .day-number {
    font-size: 13px;
  }

  .day-badge {
    font-size: 10px;
    padding: 2px 5px;
  }

  .holiday-line {
    font-size: 10px;
  }

  .team-vacation-line {
    font-size: 9px;
  }

  h1 { font-size: 26px; }
}
