label {
  display: grid;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--field-border);
  background: var(--field);
  border-radius: 10px;
  padding: 12px 13px;
  outline: none;
  color: var(--text-strong);
  min-width: 0;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 5%, transparent);
}
textarea {
  resize: vertical;
  min-height: 110px;
}
form {
  display: grid;
  gap: 17px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.error {
  color: var(--error);
  font-size: 13px;
  line-height: 1.5;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #14233855;
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal {
  width: min(530px, 100%);
  height: auto;
  max-height: calc(100dvh - 40px);
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 24px;
  background: var(--field);
  padding: 28px;
  box-shadow: 0 25px 90px #071a4535;
}
.modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.modal footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.modal footer .btn,
.modal footer button {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}
.modal .pin {
  font-size: 40px;
  color: var(--blue);
  letter-spacing: 8px;
  text-align: center;
  padding: 30px 0;
}

/* Employee invite */

.invite-panel {
  display: grid;
  gap: 22px;
}

.invite-method {
  display: grid;
  gap: 14px;
}

.invite-method h3 {
  margin: 0 0 4px;
  color: var(--text-strong);
  font-size: 15px;
}

.invite-method p {
  margin: 0;
}

.invite-method form {
  display: grid;
  gap: 14px;
}

.invite-code-box {
  position: relative;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: center;
  padding: 14px 64px 14px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.invite-code-box[hidden] {
  display: none;
}

.invite-code {
  color: var(--text-strong);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 7px;
  line-height: 1;
}

.invite-copy {
  position: absolute;
  top: 50%;
  right: 14px;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--field);
  color: var(--blue);
  cursor: pointer;
}

.invite-copy:hover {
  background: var(--nav-active);
}

.invite-copy svg {
  width: 18px;
  height: 18px;
}

.invite-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.invite-divider::before,
.invite-divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--line);
}

.invite-divider span {
  flex: 0 0 auto;
}

.invite-method > .btn,
.invite-method form > .btn {
  width: 100%;
}

/* Mobile modal */

@media (max-width: 800px) {
  .modal-backdrop {
    display: grid;
    place-items: center;
    padding:
      max(16px, env(safe-area-inset-top))
      16px
      max(16px, env(safe-area-inset-bottom));
    background: #14233866;
    backdrop-filter: blur(5px);
  }
  
  .modal {
    position: relative;
    width: 100%;
    height: auto;
    max-width: 530px;
    max-height: calc(
      100dvh -
      max(16px, env(safe-area-inset-top)) -
      max(16px, env(safe-area-inset-bottom))
    );
    margin: 0;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 20px;
    background: var(--field);
    box-shadow: 0 25px 90px #071a4535;
  }

  .modal header {
    min-height: 44px;
    gap: 12px;
    margin-bottom: 14px;
  }

  .modal header h2 {
    min-width: 0;
    margin: 0;
    color: var(--text-strong);
    font-size: 19px;
    line-height: 1.25;
  }

  .modal header [data-close] {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .modal form {
    gap: 14px;
  }

  /* Кнопки */

  .modal footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
  }

  .modal footer .btn,
  .modal footer button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 11px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.2;
    white-space: normal;
  }


  .modal .pin {
    padding: 20px 0;
    font-size: 34px;
  }

  .modal .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .modal .checklist {
    max-height: min(240px, 32dvh);
  }
}
.checklist {
  max-height: 160px;
  overflow: auto;
  display: grid;
  gap: 8px;
}
.checklist label {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-soft);
  padding: 10px;
  border-radius: 8px;
}
.checklist input {
  width: 16px;
}
.toast-visible {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  max-width: calc(100vw - 32px);
  padding: 16px 24px;
  background: #243347;
  color: white;
  border-radius: 14px;
  z-index: 100;
  box-shadow: 0 8px 30px #18233225;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
}
.invite-panel {
  gap: 18px;
}

.invite-code-box {
  min-height: 70px;
}

.invite-code {
  font-size: 27px;
  letter-spacing: 6px;
}

.invite-method > .btn,
.invite-method form > .btn {
  min-height: 48px;
}
.invite-method .error.success {
  color: var(--success);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--field-disabled);
  color: var(--field-disabled-text);
  border-color: var(--field-border);
  opacity: 1;
  -webkit-text-fill-color: var(--field-disabled-text);
}


/* date picker */

.mw-date-picker {
  position: relative;
  width: 100%;
}

.mw-picker-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mw-picker-trigger:hover {
  border-color: var(--focus);
}

.mw-picker-trigger:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.mw-picker-chevron {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--muted);
  font-size: 0;
}

.mw-picker-chevron::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translate(-50%, -65%) rotate(45deg);
}

.mw-picker-trigger[aria-expanded='true']
  .mw-picker-chevron::before {
  transform: translate(-50%, -35%) rotate(225deg);
}

.mw-picker-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 300px;
  max-width: calc(100vw - 40px);
  padding: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(31, 45, 61, 0.14);
  z-index: 1000;
}

.mw-picker-popover[hidden] {
  display: none;
}

.mw-calendar-head {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.mw-calendar-head strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.mw-calendar-nav {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.mw-calendar-nav:hover {
  background: var(--surface-hover);
  color: var(--text);
}

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

.mw-calendar-weekdays {
  margin-bottom: 5px;
}

.mw-calendar-weekdays span {
  display: grid;
  place-items: center;
  height: 26px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}

.mw-calendar-empty {
  height: 34px;
}

.mw-calendar-day {
  width: 100%;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.mw-calendar-day:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.mw-calendar-day.today {
  color: var(--blue);
  font-weight: 600;
}

.mw-calendar-day.selected {
  background: var(--nav-active);
  color: var(--blue);
  font-weight: 600;
}

.mw-calendar-day.selected:hover {
  background: var(--shift-bg);
}

.mw-calendar-footer {
  display: flex;
  justify-content: center;
  margin: 10px -14px -14px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
}

.mw-calendar-footer .text-link {
  font-size: 10px;
}


/* MyWork select picker */

.mw-select-picker {
  position: relative;
  width: 100%;
}

.mw-select-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  overflow: hidden;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(31, 45, 61, 0.14);
  z-index: 1000;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
}

.mw-select-popover[hidden] {
  display: none;
}

.mw-select-option {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.mw-select-option:hover {
  background: var(--surface-hover);
}

.mw-select-option.selected {
  background: var(--nav-active);
  color: var(--blue);
}

.mw-select-check {
  flex-shrink: 0;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

/* MyWork time input */

.mw-time-input {
  position: relative;
  width: 100%;
  min-width: 0;
}

.mw-time-field {
  width: 100%;
  min-height: 42px;
  box-sizing: border-box;
  padding: 10px 44px 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.mw-time-field:hover {
  border-color: var(--focus);
}

.mw-time-field:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.mw-time-steppers {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 36px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  overflow: hidden;
  border-left: 1px solid var(--field-border);
  border-radius: 0 9px 9px 0;
}

.mw-time-step {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0;
  cursor: pointer;
}

.mw-time-step:first-child {
  border-bottom: 1px solid var(--field-border);
}

.mw-time-step::before {
  content: '';
  width: 3px;
  height: 3px;
  border-top: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
}

.mw-time-step:first-child::before {
  transform: translateY(4px) rotate(45deg);
}

.mw-time-step:last-child::before {
  transform: translateY(4px) rotate(225deg);
}

.mw-time-step:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.shift-time-range .mw-time-input {
  flex: 1;
}

/* DateTime field */

.mw-datetime-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.mw-datetime-date,
.mw-datetime-time {
  min-width: 0;
}

/* Edit shift form */

.shift-edit-form {
  display: grid;
  gap: 20px;
}

.shift-edit-form .form-grid {
  gap: 28px;
}

.shift-edit-form .hint {
  margin: 2px 0 0;
}