:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe3ee;
  --line-soft: #edf2f7;
  --sidebar: #0f1b2a;
  --sidebar-2: #13243a;
  --blue: #2563eb;
  --green: #16a34a;
  --red: #ef4444;
  --amber: #f59e0b;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 292px 1fr;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 13px;
  cursor: pointer;
}

button:hover {
  border-color: #93b4e7;
}

button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

button.danger {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

input, select {
  border: 1px solid var(--line);
  background: white;
  border-radius: 9px;
  padding: 9px 11px;
}

.sidebar {
  height: 100vh;
  overflow-y: auto;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.22), transparent 36%),
    linear-gradient(180deg, var(--sidebar), #0a1420);
  color: white;
  padding: 20px 14px;
  box-shadow: 8px 0 30px rgba(15, 23, 42, .14);
  z-index: 50;
}

.brand {
  font-size: 22px;
  font-weight: 800;
  margin: 4px 6px 22px;
}

.nav {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.nav button {
  background: transparent;
  border: 1px solid transparent;
  color: #e5eefb;
  text-align: left;
  padding: 12px 13px;
  border-radius: 10px;
}

.nav button.active {
  background: var(--blue);
  border-color: rgba(255,255,255,.14);
  color: white;
  box-shadow: 0 10px 20px rgba(37,99,235,.2);
}

.side-section {
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 18px 6px 0;
  margin-top: 16px;
}

.side-section h2 {
  margin: 0 0 12px;
  font-size: 13px;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.validation-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.pill {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
}

.pill b {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
}

.pill.good b {
  background: var(--green);
}

.pill.warn b {
  background: var(--amber);
}

.pill.bad b {
  background: var(--red);
}

.issue {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 9px;
  align-items: start;
  margin: 10px 0;
  color: #e2e8f0;
  font-size: 13px;
}

.issue .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 4px;
  background: var(--red);
}

.issue.warning .dot {
  background: var(--amber);
}

.side-ok {
  background: rgba(22,163,74,.18);
  border: 1px solid rgba(22,163,74,.4);
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
}

.coverage-card {
  margin-bottom: 16px;
}

.coverage-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  margin-bottom: 8px;
}

.coverage-title strong {
  color: #4ade80;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #86efac);
}

#coverageBox p {
  color: #cbd5e1;
  font-size: 13px;
  margin: 7px 0 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  color: #dbeafe;
  font-size: 14px;
}

.good-text {
  color: #4ade80;
}

.bad-text {
  color: #f87171;
}

.main {
  height: 100vh;
  min-width: 0;
  display: grid;
  grid-template-rows: 76px 1fr;
  overflow: hidden;
}

.toolbar {
  z-index: 40;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  background: rgba(245,247,251,.98);
  border-bottom: 1px solid var(--line);
}

.week-controls, .toolbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.week-controls strong {
  min-width: 240px;
  display: inline-flex;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  font-size: 17px;
}

.view {
  min-height: 0;
  padding: 18px 20px;
  overflow: hidden;
}

.calendar-shell {
  height: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 14px 35px rgba(15,23,42,.06);
}

.month-grid {
  display: grid;
  min-width: max-content;
}

.grid-head {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 92px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
}

.date-head {
  left: 0;
  z-index: 35;
  font-weight: 700;
}

.doctor-head strong {
  font-size: 16px;
}

.doctor-head span {
  color: var(--muted);
  margin-top: 3px;
}

.date-cell {
  position: sticky;
  left: 0;
  z-index: 20;
  height: 126px;
  background: #fbfdff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  place-items: center;
}

.date-vertical {
  transform: rotate(-90deg);
  white-space: nowrap;
  text-align: center;
}

.date-vertical strong {
  display: block;
  font-size: 16px;
}

.date-vertical span {
  display: block;
  color: var(--muted);
  font-weight: 600;
}

.doctor-day {
  position: relative;
  height: 126px;
  overflow: visible;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(to bottom, transparent 24.5%, var(--line-soft) 24.7%, var(--line-soft) 25.2%, transparent 25.4%),
    linear-gradient(to bottom, transparent 49.5%, var(--line-soft) 49.7%, var(--line-soft) 50.2%, transparent 50.4%),
    linear-gradient(to bottom, transparent 74.5%, var(--line-soft) 74.7%, var(--line-soft) 75.2%, transparent 75.4%);
}

.doctor-day:hover {
  background-color: #f8fbff;
}

.time-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.time-lines span {
  position: absolute;
  left: 6px;
  transform: translateY(-50%);
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  opacity: .75;
}

.cal-event {
  position: absolute;
  left: 34px;
  right: 8px;
  min-height: 22px;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.12;
  cursor: pointer;
  overflow: hidden;
  border: 1px solid;
  box-shadow: 0 8px 18px rgba(15,23,42,.08);
  z-index: 6;
}

.cal-event span {
  display: block;
  font-weight: 600;
  margin-bottom: 1px;
}

.cal-event strong {
  display: block;
  font-size: 13px;
}

.cal-event.oddzial {
  color: #0f3d8a;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-color: #60a5fa;
}

.cal-event.dyzur {
  color: #4c1d95;
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-color: #a78bfa;
}

.cal-event.sor {
  color: #9a3412;
  background: linear-gradient(135deg, #ffedd5, #fed7aa);
  border-color: #fb923c;
}

.cal-event.poradnia {
  color: #065f46;
  background: linear-gradient(135deg, #d1fae5, #bbf7d0);
  border-color: #34d399;
}

.cal-event.urlop {
  color: #166534;
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border-color: #22c55e;
}

.cal-event.zwolnienie {
  color: #92400e;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #f59e0b;
}

.cal-event.off {
  color: #334155;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  border-color: #94a3b8;
}

.panel {
  height: 100%;
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 14px 35px rgba(15,23,42,.06);
}

.panel h2 {
  margin-top: 0;
}

.muted-text {
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: #f8fafc;
}

dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  min-width: 380px;
  box-shadow: 0 30px 100px rgba(15,23,42,.35);
}

dialog::backdrop {
  background: rgba(15,23,42,.45);
}

dialog form {
  padding: 20px;
  display: grid;
  gap: 12px;
}

dialog h2 {
  margin: 0 0 6px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

label.row {
  display: flex;
  align-items: center;
  color: var(--text);
}

menu {
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1000px) {
  body {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .sidebar {
    height: auto;
  }

  .main {
    height: auto;
    min-height: 100vh;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .week-controls,
  .toolbar-right {
    flex-wrap: wrap;
  }

  .view {
    overflow: visible;
  }

  .calendar-shell {
    height: 80vh;
  }
}


.nominal-control {
  height: 42px;
  display: grid;
  grid-template-columns: auto 72px auto;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 9px;
  padding: 0 10px;
  color: var(--text);
  font-size: 14px;
}

.nominal-control span {
  color: var(--muted);
  font-weight: 600;
}

.nominal-control input {
  width: 72px;
  border: 0;
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  border-radius: 0;
  text-align: center;
  padding: 6px;
}

.nominal-control em {
  color: var(--muted);
  font-style: normal;
  white-space: nowrap;
}


.datetime-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}


.doctor-head-inner {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.doctor-head-text {
  min-width: 0;
  display: grid;
  gap: 3px;
  text-align: center;
  flex: 1;
}

.doctor-add-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.doctor-add-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}


.doctor-hours {
  margin-top: 6px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 12px;
  line-height: 1.1;
  color: #475569;
}

.doctor-hours b {
  font-weight: 800;
}

.doctor-hours span {
  color: #64748b;
  margin: 0;
}

.doctor-hours em {
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ede9fe;
  color: #5b21b6;
  font-style: normal;
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.doctor-hours.over b {
  color: #dc2626;
}

.doctor-hours.under b {
  color: #2563eb;
}

.doctor-hours.ok b {
  color: #16a34a;
}
