:root {
  --bg: #f7fafc;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --glass: rgba(255, 255, 255, 0.58);
  --line: rgba(148, 163, 184, 0.6);
  --line-soft: rgba(148, 163, 184, 0.46);
  --text: #111111;
  --muted: #111111;
  --primary: #64748b;
  --primary-dark: #475569;
  --primary-soft: rgba(226, 232, 240, 0.72);
  --accent: #0f766e;
  --danger: #b42318;
  --danger-soft: rgba(244, 63, 94, 0.11);
  --weekend-soft: rgba(248, 113, 113, 0.34);
  --total-band: rgba(226, 232, 240, 0.74);
  --workspace-edge-solid: rgba(241, 245, 249, 0.86);
  --workspace-edge-fill:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(241, 245, 249, 0.42)),
    rgba(241, 245, 249, 0.56);
  --total-text: #94a3b8;
  --focus: #64748b;
  --glass-border: rgba(255, 255, 255, 0.76);
  --shadow: 0 24px 70px rgba(31, 41, 55, 0.12);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 246, 250, 0.94)),
    var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(239, 246, 255, 0.42)),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 7px clamp(10px, 2vw, 18px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.48)),
    rgba(255, 255, 255, 0.46);
  border-bottom: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 18px 44px rgba(31, 41, 55, 0.08);
  backdrop-filter: blur(28px) saturate(1.22);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
}

.view-title-button,
.dialog-header h2,
.section-head h3,
.editor-form h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0;
}

.brand p,
.dialog-header p,
.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-selector {
  position: relative;
}

.view-title-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: #111111;
  padding: 0;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 800;
  line-height: 1.12;
}

.view-title-button svg {
  width: 16px;
  height: 16px;
}

.view-title-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 90;
  display: grid;
  width: max-content;
  min-width: 270px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 18px;
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 18px 44px rgba(31, 41, 55, 0.12);
}

.view-title-menu button {
  position: relative;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: #111111;
  padding: 0 12px;
  text-align: left;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.view-title-menu button.active::before {
  display: none;
}

.view-title-menu button.active {
  background: rgba(226, 232, 240, 0.78);
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, 34px);
  min-height: 34px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 24px rgba(31, 41, 55, 0.05);
  backdrop-filter: blur(16px) saturate(1.08);
}

.mode-button {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #111111;
  font-size: 13px;
  font-weight: 800;
}

.mode-button.active {
  background: rgba(255, 255, 255, 0.78);
  color: #111111;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 5px 14px rgba(31, 41, 55, 0.09);
}

.mode-switch.mode-disabled {
  opacity: 0.48;
}

.mode-switch.mode-disabled,
.mode-switch.mode-disabled .mode-button {
  cursor: default;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.field input,
.field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  outline: none;
  padding: 0 11px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 24px rgba(31, 41, 55, 0.05);
  backdrop-filter: blur(18px) saturate(1.1);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-field input {
  width: 16px;
  min-height: 16px;
  accent-color: #475569;
}

.field input:focus,
.field select:focus,
.check-row input:focus-visible,
.button:focus-visible,
.icon-button:focus-visible,
.view-title-button:focus-visible,
.tab:focus-visible,
.weekday-tab:focus-visible,
.settings-action:focus-visible,
.shift-cell:focus-visible {
  outline: 3px solid rgba(100, 116, 139, 0.18);
  outline-offset: 2px;
  border-color: var(--focus);
}

.field.compact {
  min-width: 118px;
  position: relative;
}

.field.compact select {
  appearance: none;
  padding-right: 34px;
}

.field.compact::after {
  position: absolute;
  right: 13px;
  bottom: 14px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
}

.button,
.icon-button,
.tab,
.weekday-tab,
.settings-action {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-radius: 8px;
  backdrop-filter: blur(18px) saturate(1.1);
}

.button::after,
.icon-button::after,
.tab::after,
.weekday-tab::after,
.settings-action::after,
.mode-button::after,
.circle-button::after,
.month-name-button::after,
.vertical-add-button::after,
.add-year-button::after,
.year-delete-button::after,
.cell-route-menu button::after {
  position: absolute;
  inset: 1px 1px auto;
  height: 45%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0));
  content: "";
  pointer-events: none;
}

.button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 650;
  white-space: nowrap;
}

.button.primary {
  background: rgba(226, 232, 240, 0.72);
  border-color: rgba(148, 163, 184, 0.58);
  color: #111111;
}

.button.primary:hover {
  background: rgba(203, 213, 225, 0.76);
  border-color: rgba(100, 116, 139, 0.62);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.42);
}

.settings-button {
  background: rgba(255, 255, 255, 0.52);
  border-color: rgba(255, 255, 255, 0.78);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 14px 32px rgba(31, 41, 55, 0.08);
}

.settings-button:hover {
  background: rgba(255, 255, 255, 0.76);
}

.export-selector {
  position: relative;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  flex: 0 0 auto;
}

.export-button {
  width: 38px;
  height: 38px;
  border-color: rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.42)),
    rgba(255, 255, 255, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 14px 32px rgba(31, 41, 55, 0.08);
}

.export-button svg {
  width: 20px;
  height: 20px;
}

.export-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  display: grid;
  min-width: 230px;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 16px;
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 18px 44px rgba(31, 41, 55, 0.13);
}

.export-menu button {
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #111111;
  padding: 0 12px;
  text-align: left;
  font-weight: 800;
}

.export-menu button:hover {
  background: rgba(226, 232, 240, 0.78);
}

#closeSettingsButton {
  border: 0;
  background: transparent;
  box-shadow: none;
}

#closeSettingsButton::after {
  display: none;
}

.workspace {
  flex: 1;
  min-height: 0;
  padding: 8px 0 16px;
}

.schedule-surface {
  height: calc(100vh - 72px);
  min-height: 420px;
  border-top: 1px solid var(--glass-border);
  border-right: 0;
  border-bottom: 1px solid var(--glass-border);
  border-left: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.24)),
    rgba(255, 255, 255, 0.22);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset 0 -1px 0 rgba(255, 255, 255, 0.42),
    0 24px 68px rgba(31, 41, 55, 0.1);
  backdrop-filter: blur(28px) saturate(1.18);
}

.schedule-scroll {
  width: 100%;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #a8b7b2 #eef3f1;
  -webkit-overflow-scrolling: touch;
}

.schedule-table {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: rgba(255, 255, 255, 0.18);
  --fio-width: 104px;
}

.schedule-table th,
.schedule-table td {
  border-right: 1px solid rgba(148, 163, 184, 0.58);
  border-bottom: 1px solid rgba(148, 163, 184, 0.58);
  vertical-align: middle;
}

.schedule-table th {
  height: 26px;
  color: #111111;
  background: rgba(255, 255, 255, 0.34);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  backdrop-filter: blur(18px) saturate(1.12);
}

.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 12;
}

.schedule-table thead tr:nth-child(2) th {
  top: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.82);
}

.fio-cell,
.fio-head {
  position: sticky;
  left: 0;
  z-index: 35;
  width: var(--fio-width);
  min-width: var(--fio-width);
  max-width: var(--fio-width);
  text-align: left;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 1px 0 0 var(--line);
  backdrop-filter: blur(20px) saturate(1.1);
}

.fio-head {
  z-index: 80;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.98);
}

.schedule-table thead .fio-head {
  z-index: 90;
  background: rgba(255, 255, 255, 0.98);
}

.fio-cell {
  padding: 0 6px;
}

.fio-cell[draggable="true"] {
  cursor: grab;
}

.fio-cell[draggable="true"]:active {
  cursor: grabbing;
}

.fio-cell.has-fio-color {
  background: var(--fio-color) !important;
}

.schedule-row.dragging-row .fio-cell {
  opacity: 0.62;
}

.schedule-row:hover td:not(.row-add-cell),
.schedule-row:focus-within td:not(.row-add-cell) {
  box-shadow: inset 0 0 0 9999px rgba(37, 99, 235, 0.075);
}

.schedule-row:hover .fio-cell,
.schedule-row:focus-within .fio-cell {
  box-shadow:
    1px 0 0 var(--line),
    inset 0 0 0 9999px rgba(37, 99, 235, 0.09);
}

.schedule-row.has-separator td {
  border-bottom: 3px solid rgba(148, 163, 184, 0.72);
}

.employee-name {
  display: block;
  overflow: hidden;
  color: #111111;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.24;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-head {
  height: 10px !important;
  padding: 0 !important;
  border-color: rgba(148, 163, 184, 0.62) !important;
  border-right-color: transparent !important;
  background: var(--total-band) !important;
  color: #111111 !important;
  text-transform: uppercase;
  font-size: 8.4px !important;
  line-height: 9px !important;
  letter-spacing: 0;
}

.month-name-button {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: 800;
  line-height: 9px;
  text-transform: uppercase;
}

.day-head {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  height: 26px !important;
  padding: 0;
  border-color: rgba(148, 163, 184, 0.62) !important;
}

.day-number {
  display: block;
  font-size: 12px;
  line-height: 26px;
}

.day-head:not(.red-day):not(.today-head) {
  background: rgba(226, 232, 240, 0.74);
  border-bottom: 1px solid var(--total-band) !important;
  color: #111111;
}

.red-day {
  background: var(--weekend-soft) !important;
  color: #111111 !important;
}

.month-total-head,
.quarter-total-head,
.visible-total-head,
.month-total-cell,
.quarter-total-cell,
.visible-total-cell,
.absence-total-head,
.absence-total-cell,
.add-month-head,
.row-add-cell {
  background: var(--workspace-edge-solid) !important;
  color: #111111;
  font-weight: 800;
}

.month-total-head,
.month-total-cell {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
}

.quarter-total-head,
.quarter-total-cell {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  background: var(--workspace-edge-solid) !important;
}

.absence-total-head,
.absence-total-cell {
  width: 54px;
  min-width: 54px;
  max-width: 54px;
}

.visible-total-head,
.visible-total-cell {
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  background: var(--workspace-edge-solid) !important;
  color: #111111;
}

.shift-cell {
  position: relative;
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  height: 33px;
  padding: 0;
  background: rgba(255, 255, 255, 0.38);
  color: #111111;
  text-align: center;
  user-select: none;
  backdrop-filter: blur(12px) saturate(1.05);
}

.shift-cell:hover {
  background: rgba(255, 255, 255, 0.9);
}

.fill-handle {
  position: absolute;
  right: 1px;
  bottom: 1px;
  z-index: 2;
  width: 7px;
  height: 7px;
  border-right: 2px solid rgba(100, 116, 139, 0.72);
  border-bottom: 2px solid rgba(100, 116, 139, 0.72);
  opacity: 0;
  cursor: crosshair;
}

.shift-cell:hover .fill-handle,
.shift-cell:focus-visible .fill-handle,
.shift-cell.is-fill-source .fill-handle {
  opacity: 1;
}

.shift-cell.fill-preview,
.shift-cell.is-fill-source {
  outline: 2px solid rgba(100, 116, 139, 0.62);
  outline-offset: -2px;
}

.shift-cell.has-route-duplicate {
  box-shadow: inset 0 0 0 2px rgba(220, 38, 38, 0.82);
}

.shift-cell.has-compliance-warning {
  outline: 2px solid rgba(245, 158, 11, 0.95);
  outline-offset: -2px;
}

.shift-cell.is-generating-route {
  z-index: 4;
  animation: route-generation-pop var(--generation-highlight-ms, 1200ms) cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes route-generation-pop {
  0% {
    transform: scale(0.72);
    background: rgba(254, 240, 138, 0.98);
    box-shadow:
      0 0 0 0 rgba(37, 99, 235, 0.45),
      inset 0 0 0 2px rgba(37, 99, 235, 0.85);
  }

  42% {
    transform: scale(1.18);
    box-shadow:
      0 0 0 8px rgba(37, 99, 235, 0.16),
      inset 0 0 0 2px rgba(37, 99, 235, 0.72);
  }

  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 0 rgba(37, 99, 235, 0),
      inset 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.shift-cell.has-comment::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 8px solid rgba(248, 113, 113, 0.72);
  border-left: 8px solid transparent;
  content: "";
}

.shift-cell.has-sick-cross::before,
.shift-cell.has-sick-cross::after {
  position: absolute;
  top: 50%;
  left: 3px;
  z-index: 3;
  width: calc(100% - 6px);
  height: 2px;
  background: rgba(220, 38, 38, 0.82);
  content: "";
  pointer-events: none;
}

.shift-cell.has-sick-cross::before {
  transform: rotate(45deg);
}

.shift-cell.has-sick-cross::after {
  transform: rotate(-45deg);
}

.shift-cell.has-comment.has-sick-cross::after {
  border: 0;
}

.shift-cell.has-order-frame {
  box-shadow:
    inset 0 0 0 2px rgba(34, 197, 94, 0.86),
    inset 0 0 0 4px rgba(220, 252, 231, 0.82);
}

.shift-text {
  display: block;
  overflow: hidden;
  height: 33px;
  color: #111111;
  font-size: 14.4px;
  font-weight: 400;
  line-height: 33px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shift-cell.status-route .shift-text,
.cell-route-menu .status-route {
  font-size: 13.2px;
}

.shift-cell.status-reserve .shift-text,
.shift-cell.status-periodic .shift-text,
.cell-route-menu .status-reserve,
.cell-route-menu .status-periodic {
  font-size: 10.8px;
}

.shift-cell.status-vacation-correction .shift-text,
.cell-route-menu .status-vacation-correction {
  font-size: 8.8px;
}

.mode-button:disabled {
  color: #111111;
}

.shift-cell.status-off,
.cell-route-menu .status-off {
  background: rgba(255, 255, 255, 0.96) !important;
}

.shift-cell.red-day,
.shift-cell.red-day.status-off,
.shift-cell.red-day:hover {
  background: var(--weekend-soft) !important;
}

.shift-cell.status-off .shift-text,
.cell-route-menu .status-off {
  color: #cbd5e1;
}

.shift-cell.red-day.status-off .shift-text {
  color: #111111;
}

.shift-cell.status-vacation,
.cell-route-menu .status-vacation {
  background-color: rgba(196, 181, 253, 0.74) !important;
  background-image: radial-gradient(rgba(255, 255, 255, 0.92) 1px, transparent 1.4px);
  background-size: 7px 7px;
}

.shift-cell.status-vacation-correction,
.cell-route-menu .status-vacation-correction {
  background-color: rgba(216, 180, 254, 0.72) !important;
  background-image: radial-gradient(rgba(255, 255, 255, 0.94) 1px, transparent 1.4px);
  background-size: 6px 6px;
}

.shift-cell.status-reserve,
.cell-route-menu .status-reserve {
  background: rgba(248, 113, 113, 0.78) !important;
}

.shift-cell.status-periodic,
.cell-route-menu .status-periodic {
  background: rgba(231, 211, 174, 0.82) !important;
}

.shift-cell.status-study,
.cell-route-menu .status-study {
  background: rgba(246, 231, 196, 0.74) !important;
}

.shift-cell.status-module1,
.cell-route-menu .status-module1 {
  background: rgba(186, 230, 253, 0.74) !important;
}

.shift-cell.status-module2,
.cell-route-menu .status-module2 {
  background: rgba(187, 247, 208, 0.72) !important;
}

.shift-cell.status-eight,
.cell-route-menu .status-eight {
  background: rgba(188, 156, 107, 0.7) !important;
}

.shift-cell.status-sick,
.cell-route-menu .status-sick {
  background: rgba(203, 213, 225, 0.96) !important;
}

.shift-cell.has-custom-bg {
  background: var(--custom-bg) !important;
}

.day-head.red-day {
  background: var(--weekend-soft) !important;
}

.status-empty .shift-text {
  color: #111111;
}

.today-head,
.today-cell {
  background: rgba(107, 114, 128, 0.18) !important;
  box-shadow: none;
}

.month-total-cell,
.quarter-total-cell,
.visible-total-cell,
.absence-total-cell {
  padding: 0 4px;
  color: var(--total-text);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.month-total-head {
  font-size: 10px !important;
}

.month-total-head,
.quarter-total-head,
.visible-total-head,
.absence-total-head,
.add-month-head,
.month-total-cell,
.quarter-total-cell,
.visible-total-cell,
.absence-total-cell {
  border-right: 0 !important;
  border-bottom: 0 !important;
}

.month-total-cell,
.quarter-total-cell,
.absence-total-cell {
  box-shadow: none;
}

.month-total-cell.is-underwork,
.month-total-cell.is-top-overtime {
  color: #b42318;
  font-weight: 900;
}

.month-total-cell.is-overtime {
  color: #b42318;
}

.absence-total-cell.is-alert {
  background: rgba(248, 113, 113, 0.28) !important;
  color: #b42318;
}

.row-add-cell,
.add-month-head,
.month-total-head,
.quarter-total-head,
.absence-total-head {
  padding: 0;
  text-align: center;
}

.add-month-head,
.row-add-cell {
  width: 78px;
  min-width: 78px;
  max-width: 78px;
}

.row-add-cell {
  position: relative;
  overflow: visible;
  z-index: 28;
  border-right-color: transparent !important;
  border-bottom-color: transparent !important;
}

.circle-button {
  position: relative;
  overflow: hidden;
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(180, 191, 199, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: #64748b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.circle-button::before {
  content: "+";
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.circle-button svg + * ,
.circle-button svg {
  display: none;
}

.circle-button.tiny {
  width: 22px;
  height: 22px;
}

.circle-button.tiny::before {
  font-size: 15px;
}

.vertical-add-button {
  position: absolute;
  top: -38px;
  right: auto;
  bottom: 0;
  left: 50%;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  height: auto;
  min-height: 0;
  border: 1px solid rgba(148, 163, 184, 0.44);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.48)),
    rgba(255, 255, 255, 0.66);
  color: #111111;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  writing-mode: horizontal-tb;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 -1px 0 rgba(255, 255, 255, 0.42);
  transform: translateX(-50%);
  backdrop-filter: blur(18px) saturate(1.18);
}

.vertical-add-label {
  display: inline-block;
  transform: rotate(-90deg);
  transform-origin: center;
}

.vertical-add-button:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.62)),
    rgba(255, 255, 255, 0.78);
}

.day-summary-row td {
  height: 28px;
  border-top: 15px solid var(--workspace-edge-solid);
  border-right: 0 !important;
  border-bottom-color: transparent !important;
  background: rgba(255, 255, 255, 0.84) !important;
}

.summary-label {
  color: #111111;
  font-size: 12px;
  font-weight: 800;
}

.day-summary-cell {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  color: #111111;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.day-summary-cell.has-missing-routes {
  background: rgba(248, 113, 113, 0.34) !important;
  color: #991b1b;
  box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.34);
}

.day-summary-row .day-summary-gap {
  background: rgba(255, 255, 255, 0.84) !important;
  border-right: 0 !important;
  border-bottom-color: transparent !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(226, 232, 240, 0.46);
  backdrop-filter: blur(16px) saturate(1.12);
}

.settings-dialog {
  display: flex;
  width: min(1120px, 100%);
  height: min(760px, calc(100vh - 44px));
  max-height: min(760px, calc(100vh - 44px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.5)),
    rgba(255, 255, 255, 0.56);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    var(--shadow);
  backdrop-filter: blur(32px) saturate(1.22);
}

.dialog-header,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dialog-header {
  padding: 12px 18px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.36);
}

.dialog-header h2 {
  font-size: 22px;
}

.settings-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.department-selector {
  position: relative;
}

.department-selector-button {
  position: relative;
  display: inline-flex;
  min-width: 210px;
  max-width: 320px;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.44);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.5)),
    rgba(255, 255, 255, 0.66);
  color: #111111;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.department-selector-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.department-selector-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.department-selector-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 180;
  display: grid;
  width: 260px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 16px;
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 18px 44px rgba(31, 41, 55, 0.12);
}

.department-selector-menu button {
  min-height: 34px;
  border: 0;
  background: #ffffff;
  color: #111111;
  padding: 0 12px;
  text-align: left;
  font-weight: 700;
}

.department-selector-menu button.active {
  background: rgba(226, 232, 240, 0.78);
}

.tabs {
  display: flex;
  gap: 0;
  padding: 8px 18px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  min-height: 34px;
  padding: 0 13px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  color: #111111;
  font-weight: 700;
}

.tab.active {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(148, 163, 184, 0.42);
  border-bottom-color: rgba(255, 255, 255, 0.86);
  color: #111111;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.06);
}

.dialog-body {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 14px 18px 18px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.section-head {
  margin-bottom: 10px;
}

.section-head h3 {
  font-size: 18px;
}

.section-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.department-title-input {
  width: min(420px, 52vw);
  min-height: 30px;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #111111;
  outline: none;
  padding: 0;
  text-align: right;
  font-size: 15px;
  font-weight: 800;
}

.department-title-input::placeholder {
  color: rgba(100, 116, 139, 0.72);
}

.routes-head {
  align-items: center;
  display: grid;
  grid-template-columns: auto minmax(260px, 430px);
  position: sticky;
  top: 0;
  z-index: 25;
  padding: 8px 0;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(248, 250, 252, 0.82)),
    rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px) saturate(1.08);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

.table-wrap {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.38)),
    rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 16px 42px rgba(31, 41, 55, 0.08);
  backdrop-filter: blur(24px) saturate(1.16);
}

.table-with-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
}

.table-actions-rail {
  display: grid;
  gap: 0;
  width: 64px;
}

.rail-head {
  height: 39px;
}

.rail-row {
  display: grid;
  height: 47px;
  grid-auto-flow: column;
  place-items: center;
  align-content: center;
  gap: 4px;
}

.route-group-rail {
  height: 34px;
}

.settings-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.settings-table th,
.settings-table td {
  padding: 8px 10px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

.settings-table th {
  height: 39px;
  background: rgba(248, 250, 252, 0.76);
  color: #111111;
  font-size: 12px;
  font-weight: 800;
}

.settings-table .route-group-row th {
  height: 34px;
  background: rgba(226, 232, 240, 0.72);
  color: #111111;
  font-size: 12px;
  text-transform: uppercase;
}

.settings-table td {
  height: 47px;
  color: #111111;
  font-size: 14px;
}

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

.employees-table {
  width: max-content;
  min-width: max-content;
}

.employees-table-shell {
  max-height: min(640px, calc(100vh - 260px));
  overflow: auto;
}

.employees-table-wrap {
  overflow: visible;
  min-width: max-content;
}

.employees-table thead th {
  position: sticky;
  top: 0;
  z-index: 18;
  background: rgba(248, 250, 252, 0.98);
}

.employees-table th:nth-child(1),
.employees-table td:nth-child(1) {
  left: 0;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
}

.employees-table th:nth-child(2),
.employees-table td:nth-child(2) {
  left: 220px;
  width: 170px;
  min-width: 170px;
  max-width: 170px;
}

.employees-table th:nth-child(3),
.employees-table td:nth-child(3) {
  left: 390px;
  width: 112px;
  min-width: 112px;
  max-width: 112px;
}

.employees-table th:nth-child(4),
.employees-table td:nth-child(4) {
  width: 104px;
  min-width: 104px;
  max-width: 104px;
}

.employees-table th:nth-child(5),
.employees-table td:nth-child(5) {
  width: 104px;
  min-width: 104px;
  max-width: 104px;
}

.employees-table th:nth-child(6),
.employees-table td:nth-child(6) {
  width: 128px;
  min-width: 128px;
  max-width: 128px;
}

.employees-table th:nth-child(7),
.employees-table td:nth-child(7) {
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  text-align: center;
}

.employees-table th:nth-child(-n + 3),
.employees-table td:nth-child(-n + 3) {
  position: sticky;
  z-index: 8;
  background: rgba(255, 255, 255, 0.96);
}

.employees-table th:nth-child(-n + 3) {
  z-index: 24;
  background: rgba(248, 250, 252, 0.98);
}

.action-cell {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.settings-action {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset 0 -1px 0 rgba(255, 255, 255, 0.42),
    0 10px 22px rgba(31, 41, 55, 0.08);
}

.settings-action.danger {
  border-color: #ffd2cf;
  background: var(--danger-soft);
  color: var(--danger);
}

.route-add-menu {
  position: fixed;
  z-index: 220;
  display: grid;
  min-width: 178px;
  gap: 4px;
  border: 1px solid rgba(148, 163, 184, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 18px 44px rgba(31, 41, 55, 0.14);
  padding: 4px;
  backdrop-filter: blur(22px) saturate(1.18);
}

.route-add-menu button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #111111;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.route-add-menu button:hover {
  background: rgba(226, 232, 240, 0.78);
}

.editor-form,
.route-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(18px) saturate(1.08);
}

.editor-form[hidden] {
  display: none;
}

.editor-form h4 {
  font-size: 16px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.weekday-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  width: min(430px, 100%);
  gap: 0;
  margin-bottom: 0;
}

.weekday-tab {
  min-height: 30px;
  border-radius: 0;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.weekday-tab:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.weekday-tab:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.weekday-tab.active {
  background: rgba(148, 163, 184, 0.28);
  border-color: rgba(100, 116, 139, 0.72);
  color: #111111;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.06);
}

.route-table-wrap {
  margin-top: 0;
}

.direction-manager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.direction-chip-row {
  display: flex;
  min-width: 0;
  gap: 4px;
  overflow: auto;
  scrollbar-width: thin;
}

.direction-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: #111111;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.direction-chip button {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(254, 226, 226, 0.9);
  color: #991b1b;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.direction-empty,
.muted-cell {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.direction-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.direction-add-input {
  min-height: 32px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.74);
  padding: 0 8px;
}

.direction-add-button {
  min-height: 32px;
  padding: 0 10px;
}

.direction-select-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  align-items: center;
  width: 100%;
  min-height: 30px;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.36);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.64);
  color: #111111;
  padding: 0 8px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.direction-select-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.direction-select-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.direction-select-menu {
  position: fixed;
  z-index: 220;
  display: grid;
  max-height: min(260px, calc(100vh - 24px));
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 18px 44px rgba(31, 41, 55, 0.14);
  padding: 4px;
  backdrop-filter: blur(22px) saturate(1.18);
}

.direction-select-menu button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #111111;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.direction-select-menu button:hover,
.direction-select-menu button.active {
  background: rgba(226, 232, 240, 0.78);
}

.routes-table {
  min-width: 860px;
}

.routes-table th:nth-child(1),
.routes-table td:nth-child(1) {
  min-width: 190px;
}

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

.routes-table th:not(:first-child),
.routes-table td:not(:first-child) {
  min-width: 128px;
}

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

.employee-direction-head,
.employee-direction-check-cell {
  min-width: 92px;
  max-width: 120px;
  text-align: center !important;
}

.employee-direction-head {
  white-space: normal;
  line-height: 1.15;
}

.employee-actions-head,
.employee-actions-cell {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  text-align: center !important;
}

.employee-actions-cell .action-cell {
  justify-content: center;
}

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

.departments-table th:nth-child(1),
.departments-table td:nth-child(1) {
  min-width: 220px;
}

.departments-table th:nth-child(n + 2):nth-child(-n + 5),
.departments-table td:nth-child(n + 2):nth-child(-n + 5) {
  min-width: 190px;
}

.department-rail-head {
  height: 39px;
}

.department-rail-row {
  min-height: 74px;
  height: auto;
}

.table-input {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111111;
  outline: none;
  padding: 0;
  box-shadow: none;
}

.time-text-input {
  text-align: center;
}

.checkbox-cell {
  text-align: center;
}

.table-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #475569;
}

.table-input::placeholder {
  color: #64748b;
}

.table-input:focus {
  background: rgba(148, 163, 184, 0.14);
  box-shadow: none;
}

.route-name-input {
  font-weight: 700;
}

.department-name-cell {
  font-weight: 800;
}

.admin-role-select {
  min-width: 148px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.54)),
    rgba(255, 255, 255, 0.74);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.role-check-list {
  display: flex;
  min-height: 56px;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.role-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0 7px 0 5px;
  color: #111111;
  font-size: 11px;
  font-weight: 800;
}

.role-check input {
  width: 12px;
  height: 12px;
  accent-color: #64748b;
}

.muted-cell {
  color: rgba(100, 116, 139, 0.74);
  font-size: 12px;
  font-weight: 700;
}

.norms-layout {
  display: block;
  align-items: start;
}

.norm-grid {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.norms-table {
  min-width: 900px;
}

.norms-table th {
  background: rgba(248, 250, 252, 0.98);
}

.norms-table td {
  background: rgba(255, 255, 255, 0.94);
}

.norm-input {
  max-width: 90px;
  background: rgba(255, 255, 255, 0.98);
}

.norm-summary {
  display: none;
}

.cell-popover {
  position: fixed;
  z-index: 160;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.cell-route-menu {
  display: grid;
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  max-height: min(206px, calc(100vh - 20px));
  overflow: auto;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.62);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.34)),
    rgba(255, 255, 255, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 18px 44px rgba(31, 41, 55, 0.18);
  backdrop-filter: blur(22px) saturate(1.18);
  scrollbar-width: none;
}

.cell-route-menu::-webkit-scrollbar {
  display: none;
}

.cell-route-menu button {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  overflow: hidden;
  min-height: 34px;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.48);
  color: #111111;
  padding: 0;
  text-align: center;
  font-weight: 800;
}

.cell-route-menu button:hover {
  background: rgba(226, 232, 240, 0.74);
}

.route-menu-divider {
  width: 34px;
  height: 1px;
  background: rgba(100, 116, 139, 0.32);
}

.cell-editor,
.employee-menu {
  display: grid;
  gap: 5px;
  width: 156px;
  padding: 6px;
  border: 1px solid rgba(148, 163, 184, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.44)),
    rgba(255, 255, 255, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 18px 44px rgba(31, 41, 55, 0.14);
  backdrop-filter: blur(22px) saturate(1.18);
}

.app-notification {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 300;
  max-width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, 10px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(185, 28, 28, 0.32);
  border-radius: 8px;
  background: rgba(254, 242, 242, 0.96);
  color: #7f1d1d;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 18px 44px rgba(31, 41, 55, 0.18);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-notification.visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.access-gate-cell {
  width: 100vw;
  height: calc(100vh - 96px);
  border: 0 !important;
  background: transparent !important;
  padding: 22px;
}

.access-gate {
  width: min(420px, 100%);
  margin: 68px auto 0;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.76)),
    rgba(255, 255, 255, 0.82);
  color: #111111;
  padding: 20px;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    0 18px 44px rgba(31, 41, 55, 0.12);
}

.access-gate h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.2;
}

.access-gate p {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.45;
}

.access-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 16px;
}

.access-form input {
  min-width: 0;
  height: 38px;
  border: 1px solid rgba(148, 163, 184, 0.52);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: #111111;
  padding: 0 10px;
  outline: none;
}

.access-form input:focus {
  border-color: rgba(100, 116, 139, 0.82);
  box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.24);
}

.access-gate .access-hint {
  margin-top: 10px;
  color: #64748b;
  font-size: 12px;
}

body.mini-app-mode .schedule-surface,
body.mini-app-mode .schedule-table th,
body.mini-app-mode .fio-cell,
body.mini-app-mode .fio-head,
body.mini-app-mode .shift-cell {
  backdrop-filter: none !important;
}

body.mini-app-mode .schedule-surface {
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

body.mini-app-mode .schedule-row:hover td:not(.row-add-cell),
body.mini-app-mode .schedule-row:focus-within td:not(.row-add-cell) {
  box-shadow: none;
}

body.mini-app-mode .schedule-row:hover .fio-cell,
body.mini-app-mode .schedule-row:focus-within .fio-cell {
  box-shadow: 1px 0 0 var(--line);
}

body.mini-app-mode .shift-cell:hover {
  background: rgba(255, 255, 255, 0.38);
}

.employee-menu {
  position: fixed;
  z-index: 165;
}

.cell-color-row,
.fio-color-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px 3px;
}

.cell-color-button,
.fio-color-button {
  width: 28px;
  height: 21px;
  border: 1px solid rgba(148, 163, 184, 0.58);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)),
    var(--swatch);
}

.cell-color-button.active,
.fio-color-button.active {
  box-shadow: inset 0 0 0 2px rgba(100, 116, 139, 0.62);
}

.cell-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.cell-meta-button {
  min-height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: #111111;
  font-size: 11px;
  font-weight: 800;
}

.cell-meta-button.active.danger {
  border-color: rgba(220, 38, 38, 0.52);
  background: rgba(254, 226, 226, 0.92);
  color: #b42318;
}

.cell-meta-button.active.order {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(220, 252, 231, 0.92);
  color: #166534;
}

.cell-comment-input {
  width: 100%;
  min-height: 74px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: #111111;
  outline: none;
  padding: 6px 7px;
  font-size: 12px;
  line-height: 1.35;
  resize: none;
}

.employee-menu-action {
  min-height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.68);
  color: #111111;
  font-size: 12px;
  font-weight: 700;
}

.add-year-button,
.year-delete-button {
  position: relative;
  min-height: 30px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: #111111;
  font-weight: 800;
  backdrop-filter: blur(14px);
}

.year-delete-button,
.add-year-button {
  width: 100%;
}

.year-delete-button {
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.year-delete-button::after {
  display: none;
}

.norms-table td[rowspan],
.norms-table td {
  vertical-align: middle;
}

.norms-table td[rowspan] {
  text-align: center;
}

.month-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(226, 232, 240, 0.38);
  backdrop-filter: blur(12px);
}

.month-dialog {
  width: min(320px, 100%);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.generator-dialog {
  width: min(520px, 100%);
}

.month-modal.is-live-generation {
  place-items: end center;
  padding: 14px;
  background: transparent;
  pointer-events: none;
  backdrop-filter: none;
}

.month-modal.is-live-generation .month-dialog {
  width: min(560px, calc(100% - 28px));
  padding: 12px 14px;
  pointer-events: auto;
}

.month-modal.is-live-generation h2,
.month-modal.is-live-generation p,
.month-modal.is-live-generation .generator-field,
.month-modal.is-live-generation .generator-actions {
  display: none;
}

.month-modal.is-live-generation .generator-loading {
  margin-top: 0;
}

.export-dialog {
  width: min(420px, 100%);
}

.export-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-close-button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.modal-close-button::after {
  display: none;
}

.export-options {
  display: grid;
  max-height: min(420px, 58vh);
  gap: 6px;
  overflow: auto;
  scrollbar-width: none;
}

.export-options::-webkit-scrollbar {
  display: none;
}

.export-option-button {
  position: relative;
  overflow: hidden;
  min-height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.44);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.56)),
    rgba(255, 255, 255, 0.7);
  color: #111111;
  padding: 0 12px;
  text-align: left;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.export-option-button::after {
  position: absolute;
  inset: 1px 1px auto;
  height: 45%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0));
  content: "";
  pointer-events: none;
}

.export-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.export-date-grid {
  display: grid;
  grid-template-columns: 1fr 0.8fr 0.8fr;
  gap: 8px;
  margin-bottom: 14px;
}

.export-date-field {
  display: grid;
  gap: 6px;
  color: #111111;
  font-size: 12px;
  font-weight: 800;
}

.export-date-field select {
  min-height: 38px;
  border: 1px solid rgba(148, 163, 184, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.74);
  color: #111111;
  padding: 0 10px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.month-dialog h2 {
  margin: 0;
  font-size: 18px;
}

.month-dialog p {
  margin: 8px 0 16px;
  color: var(--muted);
}

.month-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.generator-field {
  display: grid;
  gap: 6px;
  margin: 12px 0 16px;
  color: #111111;
  font-size: 13px;
  font-weight: 800;
}

.generator-field textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid rgba(148, 163, 184, 0.52);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #111111;
  padding: 10px;
  font: inherit;
  font-weight: 600;
  line-height: 1.35;
}

.generator-actions {
  flex-wrap: wrap;
}

.generator-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  margin-top: 12px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(37, 99, 235, 0.18);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.month-modal.is-loading .month-dialog {
  cursor: progress;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.danger-button {
  border-color: rgba(180, 35, 24, 0.28);
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.button:disabled {
  cursor: default;
  opacity: 0.45;
}

.date-picker {
  position: fixed;
  z-index: 190;
  width: 260px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.54);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.86)),
    #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 22px 52px rgba(31, 41, 55, 0.16);
}

.date-picker-head {
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.date-picker-head strong {
  color: #111111;
  font-size: 13px;
  text-align: center;
}

.date-picker-head button,
.date-picker-day {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(226, 232, 240, 0.54)),
    rgba(255, 255, 255, 0.74);
  color: #111111;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.date-picker-head button {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
}

.date-picker-weekdays,
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.date-picker-weekdays {
  margin-bottom: 4px;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.date-picker-empty,
.date-picker-day {
  width: 28px;
  height: 28px;
}

.date-picker-day {
  border-radius: 8px;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
}

.date-picker-day.active {
  border-color: rgba(100, 116, 139, 0.8);
  background: rgba(148, 163, 184, 0.32);
}

@media (max-width: 980px) {
  .topbar {
    align-items: center;
    flex-wrap: wrap;
    flex-direction: row;
  }

  .toolbar {
    width: auto;
    display: flex;
  }

  .settings-grid,
  .norms-layout {
    grid-template-columns: 1fr;
  }

  .routes-head {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    padding: 7px 10px;
  }

  .toolbar {
    gap: 6px;
  }

  .workspace {
    padding: 8px 0 0;
  }

  .schedule-surface {
    height: calc(100vh - 62px);
    min-height: 390px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    backdrop-filter: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
  }

  .schedule-table th,
  .fio-cell,
  .fio-head,
  .shift-cell {
    backdrop-filter: none !important;
  }

  .schedule-row:hover td:not(.row-add-cell),
  .schedule-row:focus-within td:not(.row-add-cell) {
    box-shadow: none;
  }

  .schedule-row:hover .fio-cell,
  .schedule-row:focus-within .fio-cell {
    box-shadow: 1px 0 0 var(--line);
  }

  .fio-cell,
  .fio-head {
    width: var(--fio-width);
    min-width: var(--fio-width);
    max-width: var(--fio-width);
  }

  .fio-cell {
    padding: 0 6px;
  }

  .employee-name {
    font-size: 12px;
  }

  .day-head,
  .shift-cell {
    width: 34px;
    min-width: 34px;
    max-width: 34px;
  }

  .month-total-head,
  .month-total-cell {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
  }

  .quarter-total-head,
  .quarter-total-cell {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
  }

  .visible-total-head,
  .visible-total-cell {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
  }

  .add-month-head,
  .row-add-cell {
    width: 78px;
    min-width: 78px;
    max-width: 78px;
  }

  .modal-backdrop {
    padding: 0;
  }

  .settings-dialog {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .dialog-header {
    align-items: flex-start;
    padding-right: 12px;
    padding-left: 12px;
  }

  .settings-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .department-selector {
    min-width: 0;
    flex: 1;
  }

  .department-selector-button {
    width: 100%;
    min-width: 0;
  }

  .department-selector-menu {
    right: auto;
    left: 0;
    width: min(260px, calc(100vw - 24px));
  }

  .tabs {
    padding-right: 12px;
    padding-left: 12px;
  }

  .dialog-body {
    padding: 14px 12px;
  }

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

  .department-title-input {
    width: 100%;
  }

  .routes-head {
    gap: 8px;
  }

  .direction-manager {
    grid-template-columns: 1fr;
  }

  .settings-table {
    min-width: 680px;
  }

  .norms-table {
    min-width: 320px;
  }

  .norm-grid {
    grid-template-columns: 1fr;
  }

  .weekday-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .routes-table {
    min-width: 860px;
  }

  .departments-table {
    min-width: 1060px;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .button {
    width: 100%;
  }
}
