:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --secondary: #64748b;
  --radius: 16px;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --soft-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.10), transparent 32%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
  color: var(--text);
}

a {
  color: inherit;
}

h1 {
  margin: 0 0 18px;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

h2 {
  margin: 26px 0 12px;
  font-size: 21px;
}

h3 {
  margin: 0 0 10px;
}

p {
  line-height: 1.5;
}

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

.small-text,
.small-note {
  font-size: 12px;
}

.small-note {
  margin-top: 8px;
}

/* Header and navigation */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
}

.logo-block,
.logo-link {
  flex: 0 0 auto;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

.logo-block span,
.logo-link span {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #1e293b;
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.nav-btn {
  position: relative;
  min-height: 72px;
  padding: 10px 18px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-end;
  color: #334155;
  background: transparent;
  border-left: 1px solid var(--border);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.15;
  text-align: center;
  transition: 0.18s ease;
}

.nav-btn:last-child {
  border-right: 1px solid var(--border);
}

.nav-btn:hover {
  background: #f8fafc;
  color: var(--primary-dark);
}

.nav-btn-cabinet {
  min-height: 44px;
  margin-left: 10px;
  align-self: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid #bfdbfe !important;
  border-radius: 14px;
  background: #eff6ff;
  color: var(--primary-dark);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.08);
}

.nav-btn-cabinet:hover {
  background: #dbeafe;
  color: #1e40af;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}

.menu-toggle {
  display: none;
}

/* Layout */

.wrap {
  max-width: 980px;
  margin: 28px auto;
  padding: 0 18px 40px;
}

.wrap > h1,
.home-page h1 {
  margin-top: 0;
}

.home-page {
  max-width: 960px;
  margin: 0 auto;
}

.wide-page {
  width: calc(100vw - 20px);
  max-width: none;
  margin-left: calc(50% - 50vw + 10px);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 14px;
}

.danger-card {
  border-color: #fecaca;
  background: #fffafa;
}

.empty-state {
  padding: 24px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px dashed rgba(15, 23, 42, 0.18);
}

.empty-state h3 {
  margin-top: 0;
}

/* Forms */

form:not(.inline-form):not(.duty-sign-form):not(.upload-form):not(.memo-action-form):not(.admin-action-form):not(.duty-calendar-form):not(.points-filter-form):not(.points-report-form):not(.vacation-action-form):not(.inline-delete-form):not(.slot-edit-form):not(.nurse107-pdf-form) {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

label {
  display: block;
  margin: 14px 0 7px;
  font-weight: 700;
  color: #334155;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 16px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

textarea {
  font-family: Arial, sans-serif;
  line-height: 1.5;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.inline-form label {
  display: block;
  font-weight: 700;
  color: var(--text);
}

.inline-form select {
  min-width: 180px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 8px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
}

.checkbox-row label {
  margin: 0;
}

.flash {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 13px 15px;
  border-radius: 14px;
  margin-bottom: 14px;
  font-weight: 700;
}

/* Buttons */

.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

button,
.button {
  min-height: 44px;
  padding: 12px 18px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: 0.18s ease;
}

button:hover,
.button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

button.secondary,
.button.secondary,
.secondary-btn {
  background: #e2e8f0;
  color: #334155;
}

button.secondary:hover,
.button.secondary:hover,
.secondary-btn:hover {
  background: #cbd5e1;
}

button.danger,
.button.danger {
  background: var(--danger);
}

button.danger-light,
.button.danger-light {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

button.danger-light:hover,
.button.danger-light:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.danger-btn {
  border: 0;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 800;
  cursor: pointer;
  padding: 10px 14px;
  transition: 0.18s ease;
}

.danger-btn:hover {
  background: #fecaca;
  transform: translateY(-1px);
}

.small-btn {
  padding: 8px 12px;
  font-size: 0.9rem;
}

/* Home and admin cards */

.home-hero {
  margin-bottom: 20px;
  padding: 34px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(14, 165, 233, 0.9));
  color: white;
  box-shadow: var(--shadow);
}

.home-hero h1 {
  margin: 0 0 8px;
  font-size: 34px;
}

.home-hero p {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.5;
}

.compact-hero {
  margin-bottom: 18px;
}

.admin-hero {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(37, 99, 235, 0.9));
}

.home-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.home-btn {
  min-height: 118px;
  padding: 20px;
  display: block;
  border-radius: 20px;
  background: white;
  color: #0f172a;
  border: 1px solid var(--border);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: 0.18s ease;
}

.home-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.35);
}

.home-btn strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.home-btn span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.disabled-card {
  opacity: 0.62;
  cursor: not-allowed;
  position: relative;
}

.disabled-card:hover {
  transform: none;
  border-color: var(--border);
}

.disabled-card::after {
  content: "Скоро";
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.admin-links {
  margin-top: 24px;
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
}

.admin-links h3 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.admin-links a {
  display: inline-block;
  margin: 6px 12px 6px 0;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.admin-links a:hover {
  color: var(--primary);
}

/* Generic tables */

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.schedule-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.schedule-table th,
.schedule-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.schedule-table tr:last-child td {
  border-bottom: 0;
}

.schedule-table td form {
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

.schedule-table th:nth-child(1),
.schedule-table td:nth-child(1) {
  width: 120px;
}

.schedule-table th:nth-child(2),
.schedule-table td:nth-child(2) {
  width: 180px;
}

.schedule-table th:nth-child(3),
.schedule-table td:nth-child(3) {
  width: 150px;
}

.schedule-table th:nth-child(4),
.schedule-table td:nth-child(4) {
  width: auto;
}

.schedule-table .danger {
  width: 100%;
  max-width: 130px;
  padding: 10px 12px;
  font-size: 14px;
}

.compact-list {
  margin: 6px 0 0;
  padding-left: 18px;
  line-height: 1.6;
}

/* Algorithms */

.algorithm-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.algorithm-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.algorithm-card summary {
  cursor: pointer;
  padding: 17px 19px;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  background: #f8fafc;
}

.algorithm-card summary:hover {
  background: #eff6ff;
}

.algorithm-content {
  padding: 20px;
  border-top: 1px solid var(--border);
  line-height: 1.65;
}

.algorithm-search-card {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: white;
  box-shadow: var(--shadow);
}

.algorithm-search-card label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
  color: #0f172a;
}

.algorithm-search-input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 16px;
  outline: none;
}

.algorithm-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.algorithm-search-counter {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.algorithm-no-results {
  margin-top: 14px;
}

/* Uploads */

.upload-card {
  margin: 22px 0 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.upload-details {
  padding: 0;
}

.upload-details summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #f8fafc;
  border-bottom: 1px solid transparent;
}

.upload-details summary::-webkit-details-marker {
  display: none;
}

.upload-details summary::before {
  content: "📎";
  font-size: 20px;
  margin-bottom: 2px;
}

.upload-details[open] summary {
  border-bottom-color: var(--border);
}

.upload-title {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.upload-subtitle {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.upload-content {
  padding: 18px 20px 20px;
}

.upload-form,
.upload-form + .upload-form,
.inline-delete-form,
.danger-card form,
.duty-calendar-form,
.points-filter-form,
.points-report-form {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.upload-form + .upload-form {
  margin-top: 18px;
}

.upload-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.upload-form input[type="file"] {
  padding: 12px;
  background: #f8fafc;
}

.upload-form button {
  margin-top: 8px;
}

/* Memo actions */

.memo-actions {
  width: fit-content;
  max-width: 100%;
  margin-top: 24px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.memo-action-form {
  margin: 0;
  padding: 0;
  display: flex;
}

.memo-action {
  min-height: 48px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 0;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.memo-action.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
}

.memo-action.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.memo-action.secondary {
  background: #e8eef7;
  color: #17233c;
}

.memo-action.secondary:hover {
  background: #dbe5f1;
  transform: translateY(-1px);
}

/* Duty calendar */

.duty-calendar {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  overflow-x: auto;
}

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

.calendar-weekdays {
  margin-bottom: 8px;
}

.calendar-weekdays div {
  padding: 8px 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: #64748b;
  background: #f8fafc;
  border-radius: 10px;
}

.calendar-week {
  margin-bottom: 8px;
}

.calendar-day {
  min-height: 72px;
  margin: 0;
  padding: 10px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: 0.15s ease;
}

.calendar-day:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.calendar-day input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  align-self: flex-end;
}

.calendar-day span {
  font-weight: 800;
  color: #0f172a;
}

.calendar-day.muted-day {
  opacity: 0.35;
  background: #f8fafc;
  cursor: not-allowed;
}

.calendar-day.selected-day {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px var(--primary);
}

.calendar-day.selected-day span {
  color: var(--primary-dark);
}

.duty-settings-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 90px 60px;
  gap: 8px;
  align-items: center;
}

.duty-settings-form select {
  width: 100%;
  min-width: 0;
}

.duty-settings-form button {
  width: 60px;
  min-width: 60px;
  padding-left: 0;
  padding-right: 0;
}

/* Points */

.points-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.points-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.points-table th,
.points-table td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 8px;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
}

.points-table th {
  height: 78px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.points-table tr:last-child td {
  border-bottom: 0;
}

.points-table th:last-child,
.points-table td:last-child {
  border-right: 0;
}

.points-table .employee-col {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 170px;
  max-width: 210px;
  text-align: left;
  background: #fff;
  font-weight: 800;
  white-space: normal;
}

.points-table thead .employee-col {
  z-index: 3;
  background: #f8fafc;
}

.points-table th.criterion-col {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  vertical-align: top;
  padding: 8px 4px 10px;
  white-space: normal;
}

.employee-add-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 1fr) minmax(220px, 1fr) 120px 170px auto;
  gap: 12px;
  align-items: end;
}

.employee-table input[type="date"] {
  min-width: 150px;
}

.criterion-num {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  color: var(--primary-dark);
}

.criterion-short {
  display: block;
  color: #334155;
  font-size: 11px;
  line-height: 1.15;
  font-weight: 800;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.score-select {
  width: 66px;
  min-width: 66px;
  padding: 8px;
  font-size: 14px;
  border-radius: 10px;
}

.total-cell {
  min-width: 56px;
  font-weight: 900;
  background: #eff6ff;
  color: var(--primary-dark);
}

.answer-box {
  white-space: pre-line;
  line-height: 1.55;
}

/* Employee cabinet */

.cabinet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.cabinet-header h1 {
  margin-bottom: 6px;
}

.cabinet-login-card form {
  margin-top: 16px;
}

.cabinet-info-card {
  border-left: 5px solid var(--primary);
}

.cabinet-highlight {
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 800;
  line-height: 1.45;
}

.duty-type-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 800;
  font-size: 13px;
}

/* Announcements */

.announcements {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: -4px 0 22px;
}

.announcement-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 18px;
  box-shadow: var(--soft-shadow);
}

.announcement-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #ffedd5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.announcement-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
  color: #9a3412;
}

.announcement-card p {
  margin: 0;
  color: #7c2d12;
  line-height: 1.5;
}

.announcement-card span {
  display: block;
  margin-top: 8px;
  color: #9a3412;
  font-size: 12px;
  opacity: 0.75;
}

.announcement-admin-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.announcement-admin-card {
  position: relative;
}

.home-hero-announcements {
  margin-top: 14px;
}

.home-hero-announcements p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  line-height: 1.45;
}

.home-hero-announcements strong {
  color: #fff;
  font-weight: 700;
}

/* Vacation schedule */

.vacation-scroll {
  max-height: calc(100vh - 180px);
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
  padding: 10px;
  position: relative;
}

.vacation-table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
}

.vacation-table th,
.vacation-table td {
  border-right: none !important;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}

.vacation-table th {
  overflow: visible !important;
  background: #f8fafc;
  color: #475569;
  text-align: center;
}

.vacation-table thead tr:first-child th {
  position: sticky !important;
  top: 0;
  z-index: 30;
}

.vacation-table thead tr:nth-child(2) th {
  position: sticky !important;
  top: 34px;
  z-index: 29;
}

.vacation-month-head,
.vacation-week-label-head,
.vacation-table th.vacation-name-col,
.vacation-table th.vacation-actions-col {
  background: #f8fafc !important;
}

.vacation-month-head {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 4px 2px !important;
  line-height: 1.1 !important;
  vertical-align: middle !important;
  color: #334155;
  font-size: 11px !important;
  font-weight: 700;
  border-bottom: 1px solid #cbd5e1 !important;
  border-left: 1px solid #cbd5e1 !important;
  white-space: nowrap;
  overflow: hidden;
}

.vacation-week-label-row {
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
}

.vacation-week-label-head {
  position: relative !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  padding: 0 !important;
  line-height: 1 !important;
  vertical-align: top !important;
  overflow: visible !important;
  border-bottom: 1px solid #cbd5e1 !important;
  border-left: 1px solid #e2e8f0 !important;
}

.vacation-week-label {
  position: absolute !important;
  top: 12px !important;
  left: 50% !important;
  transform: translateX(-50%) rotate(-35deg) !important;
  transform-origin: center center !important;
  display: block;
  font-size: 10px !important;
  line-height: 1 !important;
  font-weight: 700 !important;
  color: #334155 !important;
  white-space: nowrap !important;
  z-index: 30;
}

.vacation-days-row,
.vacation-day-head,
.vacation-monday-date,
.vacation-standing-date,
.vacation-rotated-date,
.vacation-day-dot {
  font-size: 0 !important;
}

.vacation-standing-date,
.vacation-rotated-date,
.vacation-day-dot {
  display: none !important;
}

.vacation-cell {
  width: auto !important;
  min-width: 2px !important;
  max-width: none !important;
  height: 26px;
  padding: 0 !important;
  background-color: #fff;
}

.vacation-monday-head,
.vacation-monday-cell {
  border-left: 1px solid #e2e8f0 !important;
}

.vacation-month-start-head,
.vacation-month-start-cell {
  border-left: 2px solid #94a3b8 !important;
}

.vacation-table td.vacation-weekend-cell {
  background-color: #fafafa;
}

.vacation-table th.vacation-weekend-head {
  background-color: #f3f4f6;
}

.vacation-table td.vacation-cell.vacation-doctor {
  background-color: #60a5fa !important;
}

.vacation-table td.vacation-cell.vacation-nurse {
  background-color: #86efac !important;
}

.vacation-table td.vacation-cell.vacation-wish {
  background-color: #fde68a !important;
}

.vacation-name-col {
  width: 175px !important;
  min-width: 175px !important;
  max-width: 175px !important;
  position: sticky !important;
  left: 0;
  z-index: 8;
  background: white;
  box-shadow: 8px 0 14px rgba(15, 23, 42, 0.06);
}

.vacation-table th.vacation-name-col {
  top: 0;
  z-index: 50 !important;
  background: #f8fafc;
  vertical-align: middle;
}

.vacation-actions-col {
  width: 58px !important;
  min-width: 58px !important;
  max-width: 58px !important;
  position: sticky !important;
  left: 0;
  z-index: 9;
  background: white;
  text-align: center;
  box-shadow: 8px 0 14px rgba(15, 23, 42, 0.06);
}

.vacation-table th.vacation-actions-col {
  top: 0;
  z-index: 60 !important;
  background: #f8fafc;
  vertical-align: middle;
}

.vacation-admin-table .vacation-name-col {
  left: 58px !important;
}

.vacation-admin-table th.vacation-name-col {
  z-index: 55 !important;
}

.vacation-table td.vacation-name-col.vacation-name-doctor {
  background: #eff6ff !important;
}

.vacation-table td.vacation-name-col.vacation-name-nurse {
  background: #f0fdf4 !important;
}

.vacation-table td.vacation-name-col.vacation-name-doctor,
.vacation-table td.vacation-name-col.vacation-name-nurse {
  background-clip: padding-box;
}

.vacation-name-col strong {
  font-size: 12px;
}

.vacation-name-col .muted {
  font-size: 10px;
}

.vacation-period-list {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.2;
}

.vacation-period-wish {
  color: #92400e;
}

.vacation-period-approved {
  color: #0f172a;
  font-weight: 700;
}

.vacation-status {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
}

.vacation-wish-block {
  display: none;
  margin-top: 16px;
}

.vacation-wish-block.show {
  display: block;
}

.vacation-period-row {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
}

.vacation-action-form {
  margin: 0 0 8px;
}

.vacation-actions-details {
  position: relative;
}

.vacation-actions-summary {
  list-style: none;
  cursor: pointer;
  display: inline-block;
  font-size: 11px;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: transparent;
  border: none;
  padding: 0;
  white-space: nowrap;
}

.vacation-actions-summary::-webkit-details-marker {
  display: none;
}

.vacation-actions-menu {
  position: static;
  width: 260px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: white;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  text-align: left;
}

.vacation-actions-menu button,
.vacation-actions-menu .button {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.vacation-edit-details {
  margin-top: 8px;
}

.vacation-edit-details summary,
.vacation-actions-details summary {
  list-style: none;
  cursor: pointer;
}

.vacation-edit-details summary::-webkit-details-marker {
  display: none;
}

.vacation-edit-summary {
  width: 100%;
  text-align: center;
}

.vacation-admin-edit-form {
  margin-top: 10px;
  min-width: 250px;
}

.vacation-table td {
  overflow: visible;
}

.vacation-year-card {
  width: 420px;
  max-width: 100%;
  margin-left: 0;
}

.vacation-year-card input,
.vacation-year-card select {
  max-width: 180px;
}

.vacation-year-card .inline-form {
  justify-content: flex-start;
  gap: 12px;
}

.vacation-calculated-end {
  margin-top: 6px;
}

.vacation-period-cards {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.vacation-period-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
}

.vacation-period-item + .vacation-period-item {
  margin-top: 10px;
}

.vacation-period-label {
  display: inline-block;
  min-width: 74px;
  font-weight: 700;
  color: #475569;
}

.vacation-period-value {
  color: #0f172a;
  font-weight: 600;
}

/* Nurse 107 */

.slot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slot-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.slot-time {
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

.slot-name {
  color: var(--text);
}

.nurse107-day-row > td {
  border-bottom: 4px solid rgba(15, 23, 42, 0.18) !important;
  padding-top: 18px !important;
  padding-bottom: 18px !important;
  vertical-align: middle;
}

.nurse107-day-row:last-child > td {
  border-bottom: none !important;
}

.nurse107-day-row + .nurse107-day-row > td {
  border-top: 8px solid transparent;
}

.nurse107-table th,
.nurse107-table td {
  padding-left: 22px;
  padding-right: 22px;
}

.nurse107-table th:first-child,
.nurse107-table td:first-child {
  width: 150px;
  min-width: 150px;
}

.nurse107-table th:nth-child(2),
.nurse107-table td:nth-child(2) {
  width: 170px;
  min-width: 170px;
}

.nurse107-table th:nth-child(3),
.nurse107-table td:nth-child(3) {
  min-width: 360px;
}

.nurse107-table .slot-pill {
  max-width: 360px;
}

.admin-action-form {
  margin: 0;
}

.nurse107-month-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  align-items: center !important;
  margin-top: 16px !important;
  padding: 12px !important;
  border: 1px solid rgba(15, 23, 42, 0.10) !important;
  border-radius: 18px !important;
  background: #f8fafc !important;
}

.nurse107-month-actions .admin-action-form {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.nurse107-inline-form {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
}

.nurse107-month-actions .compact-btn {
  min-height: 44px !important;
  max-height: 52px !important;
  padding: 8px 14px !important;
  border-radius: 14px !important;
  font-size: 0.92rem !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  white-space: normal !important;
  text-align: center !important;
  box-shadow: none !important;
}

.nurse107-checkbox-line {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 44px !important;
  padding: 0 12px !important;
  border-radius: 14px !important;
  background: #fff !important;
  border: 1px solid rgba(15, 23, 42, 0.10) !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}

.nurse107-checkbox-line input {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
}

.nurse107-month-actions .danger-soft-btn,
.nurse107-month-actions .danger-btn {
  min-height: 44px !important;
  max-height: 52px !important;
  padding: 8px 14px !important;
  border-radius: 14px !important;
  background: #fde8e8 !important;
  color: #9f1239 !important;
  border: 1px solid #f5c2c7 !important;
  font-size: 0.92rem !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  box-shadow: none !important;
}

.nurse107-month-actions .danger-soft-btn:hover,
.nurse107-month-actions .danger-btn:hover {
  background: #fbd5d5 !important;
  color: #881337 !important;
  transform: translateY(-1px) !important;
}

.nurse107-pdf-form {
  margin: 0;
}

/* Nurse 107 admin slots */

.vacation-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(2, minmax(150px, 0.8fr)) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 18px 0;
}

.vacation-form label {
  display: block;
  font-weight: 700;
  color: var(--text);
}

.admin-slot-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slot-edit-form {
  display: grid;
  grid-template-columns: 110px minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.slot-edit-time {
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

.actions-cell {
  white-space: nowrap;
  vertical-align: top;
}

/* Employees */

.employees-page {
  width: calc(100vw - 48px);
  max-width: 1380px;
  margin-left: -72px;
  margin-right: auto;
}

.employees-card {
  width: 100%;
  max-width: none;
}

.employee-table-wrap {
  overflow-x: auto;
}

.employee-table {
  min-width: 1180px;
}

.employee-table button {
  padding: 12px 16px;
  min-width: 112px;
  white-space: nowrap;
}

.employee-table input[name="full_name"],
.employee-table input[name="full_name_genitive"] {
  width: 245px;
}

.employee-table input[name="rate"] {
  width: 100px;
}

.employee-table select[name="position"],
.employee-table select[name="secondary_position"] {
  width: 135px;
}

.employee-table select[name="is_active"] {
  width: 125px;
}

/* Mobile */

@media (max-width: 900px) {
  .calendar-weekdays,
  .calendar-week {
    grid-template-columns: repeat(7, 74px);
  }

  .duty-settings-form,
  .slot-edit-form,
  .vacation-form {
    grid-template-columns: 1fr;
  }

  .duty-settings-form button {
    width: 100%;
  }

  .schedule-table {
    min-width: 760px;
  }

  .card {
    overflow-x: auto;
  }

  .nurse107-month-actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .nurse107-inline-form {
    width: 100% !important;
    flex-wrap: wrap !important;
  }

  .nurse107-inline-form .compact-btn,
  .nurse107-inline-form .danger-btn,
  .nurse107-pdf-form button {
    width: 100% !important;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    padding: 12px;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }

  .menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff !important;
    color: #334155 !important;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
  }

  .menu-toggle:hover {
    background: #f8fafc !important;
    color: var(--primary-dark) !important;
  }

  .nav-links {
    display: none !important;
    width: 100%;
    margin-left: 0;
    padding: 10px 0 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    background: transparent;
    border: 0;
    box-shadow: none;
    position: static;
  }

  .nav-links.show {
    display: flex !important;
  }

  .nav-btn {
    width: 100%;
    min-height: 42px;
    justify-content: flex-start;
    align-items: center !important;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid var(--border) !important;
    border-radius: 12px;
    background: #fff;
    font-size: 13px;
  }

  .nav-btn-cabinet {
    margin-left: 0;
    background: #eff6ff;
  }

  .wrap {
    margin: 18px auto;
    padding: 0 12px 30px;
  }

  h1 {
    font-size: 25px;
  }

  .grid,
  .home-buttons {
    grid-template-columns: 1fr;
  }

  .home-hero {
    padding: 24px;
    border-radius: 20px;
  }

  .home-hero h1 {
    font-size: 28px;
  }

  .btns,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  button,
  .button,
  .btns form {
    width: 100%;
  }

  .schedule-table,
  .schedule-table thead,
  .schedule-table tbody,
  .schedule-table tr,
  .schedule-table th,
  .schedule-table td {
    display: block;
    width: 100%;
  }

  .schedule-table {
    min-width: 0;
  }

  .schedule-table thead {
    display: none;
  }

  .schedule-table tr {
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
  }

  .schedule-table td {
    border-bottom: 0;
    padding: 8px 0;
  }

  .cabinet-header {
    flex-direction: column;
  }

  .wide-page {
    width: 100%;
    margin-left: 0;
  }

  .vacation-scroll {
    overflow-x: auto !important;
    overflow-y: visible !important;
    padding: 8px;
  }

  .vacation-table {
    width: max-content !important;
    min-width: max-content !important;
    table-layout: auto !important;
  }

  .vacation-cell,
  .vacation-day-head {
    width: 10px !important;
    min-width: 10px !important;
    max-width: 10px !important;
  }

  .vacation-week-label-head {
    min-width: 70px !important;
  }

  .vacation-month-head {
    min-width: 280px !important;
  }

  .vacation-name-col {
    width: 145px !important;
    min-width: 145px !important;
    max-width: 145px !important;
    left: 0;
  }

  .vacation-name-col strong {
    font-size: 11px;
  }

  .vacation-name-col .muted {
    font-size: 9px;
  }

  .vacation-period-list {
    font-size: 10px;
  }

  .vacation-actions-col {
    width: 54px !important;
    min-width: 54px !important;
    max-width: 54px !important;
  }

  .vacation-admin-table .vacation-name-col {
    left: 54px !important;
  }

  .vacation-actions-summary {
    font-size: 10px;
  }

  .vacation-period-card {
    padding: 12px 14px;
    border-radius: 12px;
  }

  .vacation-period-label {
    min-width: 68px;
    font-size: 14px;
  }

  .vacation-period-value {
    font-size: 15px;
  }

  .nurse107-pdf-form {
    width: 100%;
  }

  .employees-page {
    width: 100%;
    margin-left: 0;
  }
}

/* Подсветка всей недели в графике отпусков */

.vacation-table [data-week] {
  transition: box-shadow 0.08s ease, background-color 0.08s ease;
}

.vacation-table .vacation-week-hover {
  box-shadow: inset 0 0 0 9999px rgba(245, 158, 11, 0.18);
}

.vacation-table th.vacation-week-hover {
  background-color: #fef3c7 !important;
  color: #7c2d12;
}

.vacation-table td.vacation-week-hover {
  outline: 1px solid rgba(245, 158, 11, 0.45);
  outline-offset: -1px;
}

/* Подсветка строки сотрудника в графике отпусков */

.vacation-table tbody tr.vacation-row-hover > th,
.vacation-table tbody tr.vacation-row-hover > td {
  box-shadow: inset 0 0 0 9999px rgba(59, 130, 246, 0.10);
}

.vacation-table tbody tr.vacation-row-hover > th {
  background-color: #dbeafe !important;
  color: #1e3a8a !important;
}

.vacation-table tbody tr.vacation-row-hover > td.vacation-cell {
  outline: 1px solid rgba(59, 130, 246, 0.35);
  outline-offset: -1px;
}